Connect your Sidewalk device and view uplink metadata format
In this tutorial, you'll use the MQTT test client to test the connectivity and see
messages exhanged between your end device and the AWS Cloud. To receive messages, in
the MQTT test client, subscribe to the topic specified when creating the IoT rule for
your destination. You can also send a downlink message from AWS IoT Core for Amazon Sidewalk to your
device using the SendDataToWirelessDevice
API operation. You can verify
that the message was delivered by enabling the message delivery status event
notification.
Note
For information about connecting your hardware platform and setting it up, see
Provisioning and
registering your end device
Send downlink messages to your end device
Use the SendDataToWirelessDevice
API operation or the send-data-to-wireless-device
CLI command to send
downlink messages from AWS IoT Core for Amazon Sidewalk to your Sidewalk end device. Following
shows an example of how to run this command. The payload data is the binary to be
sent, encoded in base64.
aws iotwireless send-data-to-wireless-device \ --id
"<Wireless_Device_ID>"
\ --payload-data"SGVsbG8gVG8gRGV2c2lt"
\ --wireless-metadata Sidewalk={Seq=1,AckModeRetryDurationSecs=10}
Following shows a sample output of running this command, which is an ID of the downlink message sent to the device.
{ MessageId:
"6011dd36-0043d6eb-0072-0008"
}
Note
The SendDataToWirelessDevice
API can return a message ID but the
message might not be successfully delivered. To check the status of the message
that was sent to the device, you can enable message delivery status events for
your Sidewalk accounts and devices. For information about how to enable
this event, see Event notifications for Sidewalk
resources. For more information about this event
type, see Message delivery events.
View format of uplink messages from the device
After you've connected your device, you can subscribe to the topic (for example,
) that you
specified when creating the destination rule, and observe uplink messages from the
device. project/sensor/observed
If you specified a topic name when creating your destination, you can subscribe to
the topic to monitor uplink messages from your end device. Go to the MQTT test client
), and then
choose Subscribe.project/sensor/observed
The following example shows the format of the uplink messages that are sent from
Sidewalk devices to AWS IoT. The WirelessMetadata
contains
metadata about the message request.
{ "PayloadData":
"ZjRlNjY1ZWNlNw=="
, "WirelessDeviceId":"wireless_device_id"
, "WirelessMetadata":{ "Sidewalk":{ "CmdExStatus":"Cmd", "SidewalkId":"device_id
", "Seq":0, "MessageType":"messageType
" } } }
The following table shows a definition of the different parameters in the uplink
metadata. The
is the ID of the
wireless device, such as device-id
and the
ABCDEF1234
is the type of uplink
message that's received from the device.messageType
Parameter | Description | Type | Required |
---|---|---|---|
PayloadData |
The message payload that is sent from the wireless device. |
String | Yes |
WirelessDeviceID |
The identifier of the wireless device that's sending the data | String | Yes |
Sidewalk.CmdExStatus |
Command runtime status. Response-type messages shall include
the status code, |
Enumeration | No |
Sidewalk.NackExStatus |
Response nack status, which can be |
Array of strings | No |