Communication commands and events provide a mechanism for interaction between the application layer and the underlying hardware layer of the device.
Communication Commands
Communication Commands (Comm Commands) represent requests transmitted from the upper layer to the lower layer.
User inputs are ultimately converted to instructions that direct the device to perform specific actions.
For example, when a user clicks a button, the button sends a request to the lower layer to instruct the device to establish a WiFi connection. Comm Commands provide the mechanism for wrapping and transmitting these requests to the lower layer.
Comm Commands provide the capability to send requests but do not encompass business logic implementation. Device manufacturers are responsible for implementing the business logic and determining the available command set.
Communication Events
Communication Events (Comm Events) represent notifications transmitted from the lower layer to the upper layer.
When events occur in the lower layer, notifications are sent to the upper layer to trigger UI updates.
For example, when a device establishes a WiFi connection, the device sends a notification to the upper layer to update the UI. Comm Events provide the mechanism for wrapping and transmitting these notifications to the upper layer.
Comm Events provide the capability to send notifications but do not encompass business logic implementation. Device manufacturers are responsible for implementing the business logic and determining the available event set.
Status and Action of Communication Events
From a UI perspective, events typically require updates to labels, icons, or other visual elements based on specific conditions.
For communication events, status and action configurations simplify UI updates. Status and corresponding actions can be configured as needed.
For example:
To configure an image
component to receive a Bluetooth status event and display appropriate icons for connected and disconnected states:
Right-click on the
image
component and add aComm Event
forBT Status Changed
Configure the event status:
- Status: 0 (BT disconnected) Action: Set image for BT disconnected state
- Status: 1 (BT connected) Action: Set image for BT connected state
Info
The appropriate status
codes are determined by your device provider. Refer to your device documentation for available status codes. These codes are defined by the lower layer business logic.
Default Available Commands and Events
While Communication Commands and Events are device-specific, default implementations are provided for common use cases:
Time update
Bluetooth connected/disconnected
WiFi connected/disconnected
Battery level changed
These represent device commands/events with simulated implementations that must be replaced with actual device-specific implementations.
Drawer opened/closed
This represents a UI command/event rather than a device event.
These commands and events are available upon project creation and can be used directly or modified to accommodate specific business logic requirements.
Info
Communication commands and events are tightly coupled with device capabilities. For comprehensive device support, coordinate with your device provider to enable built-in support.