3. Overview of the Functionality

Amazon Sidewalk supports three link types, described in the sections below. The multi-link feature implements a connection policy framework which influences the behavior of the connection and uplink of messages using the supported links.

The multi-link feature operates at the application layer of the stack. The behavior of the links at the network, security, MAC, and PHY layers is not affected by this feature. The feature also applies when only one link is enabled by the developer’s application. It influences the message’s uplink attributes and the link’s connection timeout parameters used to send the message. The multi-link parameters are explained in detail in Link control attributes.

The feature indirectly affects the link on which downlinks are received by the end point. Sidewalk is an uplink-based protocol: the downlink from the Amazon Sidewalk cloud services always follows the link on which the last uplink is received from the end point.

The following sections describe connection establishment and connection maintenance for the three link types supported by Amazon Sidewalk.

3.1.1 Bluetooth LE

LINK: Bluetooth LE

SID_LINK_TYPE: SID_LINK_TYPE_1

Description:

  • The end point performs the role of a Bluetooth LE peripheral and the gateway the role of Bluetooth LE central.
  • Amazon Sidewalk Bluetooth LE advertisements are sent by the end point periodically indicating its presence to the Amazon Sidewalk Bluetooth LE gateways and to mobile applications that use the Amazon Sidewalk Mobile SDK. The advertisements are sent to allow the Amazon Sidewalk cloud to discover the presence of the Amazon Sidewalk end point which is in the range of any Amazon Sidewalk Bluetooth LE gateway to send a downlink or indicate the reachability of the end point to the AWS IoT Wireless managed service.
  • When the end point wants to send an uplink, it indicates its intent to connect to the Amazon Sidewalk network by changing the payload in the Bluetooth LE advertisements. The Amazon Sidewalk Bluetooth LE gateway which is in the range of the end point is instructed by the Amazon Sidewalk cloud to start the Bluetooth LE connection process and establish connection. The Amazon Sidewalk Bluetooth LE end point then sends the uplink.
  • The Amazon Sidewalk Bluetooth LE gateways do not keep the connection open indefinitely. Unless there is an activity (uplink or downlink) in the connected state, the Amazon Sidewalk Bluetooth LE gateways terminate the connection after a certain time (currently configured to 5 minutes). The end point Sidewalk stack also disconnects the Bluetooth LE connection with the Sidewalk Bluetooth LE gateways after 30 seconds without messages from the developer’s application to AWS IoT Core for Amazon Sidewalk.
  • Acknowledgments at link level are handled at the link layer by Bluetooth LE protocol stack. The Bluetooth LE protocol stack is responsible for establishing and maintaining the connection and for reporting connected and disconnected events to the Amazon Sidewalk stack. The Amazon Sidewalk Bluetooth LE stack maintains connection with Amazon Sidewalk Network while the Bluetooth LE protocol maintains the Bluetooth LE connection between the end point and the Sidewalk Bluetooth LE gateway.

Connection: On demand.

Loss and establishment of connection is notified by the underlying Bluetooth LE Stack.

References: Amazon Sidewalk Specification, SID API Developer Guide

3.1.2 SubG-FSK

LINK: SubG-FSK

SID_LINK_TYPE: SID_LINK_TYPE_2

Description:

  • The Amazon Sidewalk SubG-FSK gateways send beacons periodically (configured every 10 seconds).
  • The Amazon Sidewalk SubG-FSK endpoints synchronize with the beacons to establish and maintain connection.
  • The Amazon Sidewalk end point scans passively for Amazon Sidewalk beacons to sync (connect) to an Amazon Sidewalk gateway.
  • End points can detect connection loss with a particular SubG-FSK gateway if it fails to receive a pre-configured (currently 3) number of beacons from the currently connected gateway consecutively.
  • Acknowledgments are present at the link layer when messages are exchanged between end points and gateways thus providing link layer reliability.

Connection: Persistent (beacon-synchronized).

Loss of connection is detected by loss of synchronization of beacons from the connected Sidewalk SubG-FSK gateway. Failure to receive a join response for the join request sent by the end point even when the end point is in synchronization with Sidewalk SubG-FSK gateway’s beacons results in disconnection state.

References: Amazon Sidewalk Specification, Device Profiles Application Note

3.1.3 SubG-CSS

LINK: SubG-CSS

SID_LINK_TYPE: SID_LINK_TYPE_3

Description:

  • In Profile B, the end point stack must send periodic messages. In Profile A, no periodic messages are required.
  • Link layer acknowledgments are not present on this link type.

Connection: Connectionless.

Status of availability of link is determined only after sending a message.

References: Amazon Sidewalk Specification, Device Profiles Application Note

The following are the attributes that are controlled by the multi-link feature to pick an optimum link for sending messages.

The message uplink attributes are as follows:

  • Request Acknowledgment from AWS IoT Core for Amazon Sidewalk
  • Number of Retries
  • Time to Live

These attributes and their usage are described in Amazon Sidewalk message transmit attributes in the SID API Developer Guide.

When more than one link is enabled and no link is in connected state, the order of priority that needs to be followed to attempt connection is determined by the link priority attribute. The value has a range from 0 to 2. Value 3 and greater will cause undefined behavior. The lower the value, the higher the priority.

The maximum time in seconds for which the Amazon Sidewalk stack attempts to establish connection on a link.

In addition to the default (SID_LINK_CONNECTION_POLICY_NONE), two link connection policies are available to the developer: the auto-connect policy and the multi-link connection policy. The policies are mutually exclusive, and only one can be enabled at a time. They can also be compiled out at build time.

The link connection policy used by the stack can be selected with the sid_option API, as shown below.

The default link connection policy that stack is configured with is SID_LINK_CONNECTION_POLICY_NONE. In SID_LINK_CONNECTION_POLICY_NONE policy setting the stack does not apply any connection policy settings.

The following rules apply to all link connection policy settings in this section (the link connection policy, the auto-connect parameters, and the multi-link policy):

  • Call sid_init before setting them with sid_option.
  • They can be set even before the end point is registered and time is acquired.
  • They do not persist across reboots. The developer is expected to set them on every reboot of the device.
  • SID_ERROR_INVALID_ARGS is returned if the stack is not initialized or invalid arguments are passed to the sid_option API.

In the examples in this section, handle is the Sidewalk handle returned by sid_init().

/**
 *  Describes the connection policy setting
 */
enum sid_link_connection_policy {
    /** Default setting. Sidewalk stack does not apply any
     *  connection policy. */
    SID_LINK_CONNECTION_POLICY_NONE = 0,
    /** Auto connection policy, Sidewalk stack applies auto connection policy
     *  based on the parameters
     *  configured through auto connection policy parameters. */
    SID_LINK_CONNECTION_POLICY_AUTO_CONNECT,
    /** Multi-link connection policy, Sidewalk stack applies multi-link
     *  connection policy based on the policy
     *  configured through multi-link connection policy. */
    SID_LINK_CONNECTION_POLICY_MULTI_LINK_MANAGER,
    /** Delimiter to enum sid_link_connection_policy */
    SID_LINK_CONNECTION_POLICY_LAST
};

// IOCTL to set link connection policy

// Set link connection policy to SID_LINK_CONNECTION_POLICY_AUTO_CONNECT
enum sid_link_connection_policy set_policy =
                                SID_LINK_CONNECTION_POLICY_AUTO_CONNECT;
sid_error_t ret = sid_option(handle, SID_OPTION_SET_LINK_CONNECTION_POLICY,
                              &set_policy, sizeof(set_policy));

// IOCTL to get link connection policy

// Get configured link connection policy
enum sid_link_connection_policy get_policy;
ret = sid_option(handle, SID_OPTION_GET_LINK_CONNECTION_POLICY,
                 &get_policy, sizeof(get_policy));

When the link connection policy is configured to SID_LINK_CONNECTION_POLICY_NONE, the stack does not apply any connection policy algorithm to the messages enqueued with sid_put_msg API.

The developer is expected to establish the connection before enqueuing the message. If the link is not connected and the message is enqueued, the stack fails the message with the SID_ERROR_INVALID_STATE error code.

3.3.2 Auto-connect policy

The auto-connect policy can be enabled at build time by setting the build flag SID_SDK_CONFIG_ENABLE_AUTO_CONNECT.

The auto-connect policy lets you configure the link connection control attributes described above.

The Amazon Sidewalk stack triggers connection on a link only when a message is required to be transmitted by the developer using the sid_put_msg API.

The following shows the parameters that are available to the developer to configure the auto-connect policy. The developer can select the link types, priority among the links and connection attempt timeout seconds.

/**
 *  Describes link auto connect parameters
 */
struct sid_link_auto_connect_params {
    /** Sid link type */
    enum sid_link_type link_type;
    /** Set to true to enable auto connect on this link */
    bool enable;
    /** Priority of the link type when more than one link is specified
     *  using #sid_put_msg
     *  0 is highest priority, 2 is lowest priority */
    uint8_t priority;
    /** Maximum period up to which the stack attempts to form a connection */
    uint16_t connection_attempt_timeout_seconds;
};

// IOCTL to set auto connect parameters

// Set auto connection params for SID_LINK_TYPE_1 with priority 0 and
// connection_attempt_timeout_seconds to 30
struct sid_link_auto_connect_params params_link_1 = {
    .link_type = SID_LINK_TYPE_1,
    .enable = true,
    .priority = 0,
    .connection_attempt_timeout_seconds = 30
};

sid_error_t ret = sid_option(handle,
                             SID_OPTION_SET_LINK_POLICY_AUTO_CONNECT_PARAMS,
                             &params_link_1, sizeof(params_link_1));

// Set auto connection params for SID_LINK_TYPE_2 with priority 1 and
// connection_attempt_timeout_seconds to 120
struct sid_link_auto_connect_params params_link_2 = {
    .link_type = SID_LINK_TYPE_2,
    .enable = true,
    .priority = 1,
    .connection_attempt_timeout_seconds = 120
};
ret = sid_option(handle, SID_OPTION_SET_LINK_POLICY_AUTO_CONNECT_PARAMS,
                 &params_link_2, sizeof(params_link_2));

// Set auto connection params for SID_LINK_TYPE_3 with priority 2 and
// connection_attempt_timeout_seconds to 90
struct sid_link_auto_connect_params params_link_3 = {
    .link_type = SID_LINK_TYPE_3,
    .enable = true,
    .priority = 2,
    .connection_attempt_timeout_seconds = 90
};
ret = sid_option(handle, SID_OPTION_SET_LINK_POLICY_AUTO_CONNECT_PARAMS,
                 &params_link_3, sizeof(params_link_3));

// Disable auto connection on SID_LINK_TYPE_2 link
struct sid_link_auto_connect_params params_link_2_disable = {
    .link_type = SID_LINK_TYPE_2,
    .enable = false,
};
ret = sid_option(handle, SID_OPTION_SET_LINK_POLICY_AUTO_CONNECT_PARAMS,
                 &params_link_2_disable, sizeof(params_link_2_disable));

// IOCTL to get auto connect parameters

// Get auto connection parameters configured for SID_LINK_TYPE_1
struct sid_link_auto_connect_params get_params_link_1 = {
    .link_type = SID_LINK_TYPE_1,
};
ret = sid_option(handle, SID_OPTION_GET_LINK_POLICY_AUTO_CONNECT_PARAMS,
                 &get_params_link_1, sizeof(get_params_link_1));
3.3.2.1 Connection attempt timeout

The following table gives the minimum value of connection_attempt_timeout_seconds that can be configured for each link type.

SID_ERROR_INVALID_ARGS is returned if a value for connection_attempt_timeout_seconds is configured to be lower than the value indicated in the table below.

link_type minimum connection attempt timeout in seconds
SID_LINK_TYPE_1 10
SID_LINK_TYPE_2 30
SID_LINK_TYPE_3 20

Minimum connection attempt timeout per link type.

3.3.2.2 Auto-connect policy algorithm

Preconditions

The following conditions are required to be met for the Sidewalk stack to trigger connection on a link.

  • The link is already started using the sid_start API.
  • The end point is already registered to the Amazon Sidewalk network and time is acquired successfully.
  • The link connection policy is configured to SID_LINK_CONNECTION_POLICY_AUTO_CONNECT.
  • The auto-connect policy parameters are enabled on the link.
  • The link mask present in the sid_put_msg has this link enabled in the sid_msg_desc.
  • The size of the message that is required to be transmitted is less than the MTU of the links that are started and have the auto-connect policy parameters enabled.

Behavior

  • If a Sidewalk stack has at least one link in connected state and the connected link can send the message, the auto-connect policy algorithm is not triggered, because the connected link can send the message.
  • When the connection cannot be established on any of the links on which the policy is enabled, the policy progresses through the links in the order of priority configured by the developer, multiple times, until all the messages that are enqueued by the developer’s application have expired. When there are no messages in the end point Amazon Sidewalk stack’s send queue, the algorithm stops attempting to establish connection with the Amazon Sidewalk network.

The following examples are used to explain the behavior of the auto-connect policy algorithm.

Example 1

Conditions Algorithm Operation
• Sidewalk stack initialized and started with all links.
• At least one link is in connected state, SID_LINK_TYPE_3 is connected.
• Auto-connect policy is enabled, and auto-connect policy parameters are enabled on all three links.
• Link priority order is SID_LINK_TYPE_1 > SID_LINK_TYPE_2 > SID_LINK_TYPE_3.
• Message sent using sid_put_msg with message transmission attributes of acknowledgment required, retries and time to live set by the developer.
• Message sent using sid_put_msg has link_type set to pick any of the three links. (link_type = (SID_LINK_TYPE_1 | SID_LINK_TYPE_2 | SID_LINK_TYPE_3))
• The payload of the message that is requested to be transmitted can be sent on all the three links.
The auto-connect policy does not attempt connection on any links as the link which is in connected state will send the message on the connected link.

Example 2

Conditions Algorithm Operation
• Sidewalk stack initialized and started with all links.
• No link is in connected state.
• Auto-connect policy is enabled, and auto-connect policy parameters are enabled on all three links.
• Link priority order is SID_LINK_TYPE_1 > SID_LINK_TYPE_2 > SID_LINK_TYPE_3.
• Message sent using sid_put_msg with message transmission attributes of acknowledgment required, retries and time to live set by the developer.
• Message sent using sid_put_msg has link_type set to pick any of the three links. (link_type = (SID_LINK_TYPE_1 | SID_LINK_TYPE_2 | SID_LINK_TYPE_3))
• The payload of the message that is requested to be transmitted can be sent on all the three links.
The auto-connect policy starts attempting link connection for a period of connection timeout specified by the auto-connect policy for that link.

The order of priority to pick links for connection in this case is SID_LINK_TYPE_1 followed by SID_LINK_TYPE_2 and SID_LINK_TYPE_3.

During the course of connection attempts, if any of the links connects, the message is sent over the connected link.

If none of the links connects within the time to live in the message’s transmit attributes, the message fails with the SID_ERROR_TIMEOUT error code.

Example 3

Conditions Algorithm Operation
• Sidewalk stack initialized and started with all links.
• No link is in connected state.
• Auto-connect policy is enabled, and auto-connect policy parameters are enabled on all three links.
• Link priority order is SID_LINK_TYPE_3 > SID_LINK_TYPE_2 > SID_LINK_TYPE_1.
• Message sent using sid_put_msg with message transmission attributes of acknowledgment required, retries and time to live set by the developer.
• Message sent using sid_put_msg has link_type set to pick any of the three links. (link_type = (SID_LINK_TYPE_1 | SID_LINK_TYPE_2 | SID_LINK_TYPE_3)). The order of the bitmask does not affect the priority.
• The payload of the message that is requested to be transmitted can be sent on all the three links.
The auto-connect policy starts attempting link connection for a period of connection timeout specified by the auto-connect policy for that link.

The order of priority to pick links for connection in this case is SID_LINK_TYPE_3 followed by SID_LINK_TYPE_2 and SID_LINK_TYPE_1.

During the course of connection attempts, if any of the links connects, the message is sent over the connected link.

If none of the links connects within the time to live in the message’s transmit attributes, the message fails with the SID_ERROR_TIMEOUT error code.

Example 4

Conditions Algorithm Operation
• Sidewalk stack initialized and started with all links.
• No link is in connected state.
• Auto-connect policy is enabled, and auto-connect policy parameters are enabled on all three links.
• Link priority order is SID_LINK_TYPE_1 > SID_LINK_TYPE_2 > SID_LINK_TYPE_3.
• Message sent using sid_put_msg with message transmission attributes of acknowledgment required, retries and time to live set by the developer.
• Message sent using sid_put_msg has link_type set to pick any of the three links. (link_type = (SID_LINK_TYPE_1 | SID_LINK_TYPE_2 | SID_LINK_TYPE_3))
• The payload of the message that is requested to be transmitted can be sent only on SID_LINK_TYPE_1.
The auto-connect policy attempts link connection only on SID_LINK_TYPE_1 as SID_LINK_TYPE_2 and SID_LINK_TYPE_3 cannot send the message as the payload of the message exceeds the MTU of the two links.

If the connection can be established within the time to live of message’s transmit attributes, the message will be sent over SID_LINK_TYPE_1. Failure to send would result in message failing with SID_ERROR_TIMEOUT error code.

Example 5

Conditions Algorithm Operation
• Sidewalk stack initialized and started with all links.
• No link is in connected state.
• Auto-connect policy is enabled, and auto-connect policy parameters are enabled on all three links.
• Link priority order is SID_LINK_TYPE_1 > SID_LINK_TYPE_2 > SID_LINK_TYPE_3.
• Message sent using sid_put_msg with message transmission attributes of acknowledgment required, retries and time to live set by the developer.
• Message sent using sid_put_msg has link_type set to pick only one link. (link_type = SID_LINK_TYPE_2)
• The payload of the message that is requested to be transmitted can be sent on all the three links.
The auto-connect policy attempts link connection only on SID_LINK_TYPE_2 as SID_LINK_TYPE_1 and SID_LINK_TYPE_3 are not in the link_type setting in sid_put_msg API.

If the connection can be established within the time to live of message’s transmit attributes, the message will be sent over SID_LINK_TYPE_2.

Failure to send would result in message failing with SID_ERROR_TIMEOUT error code.

Example 6

Conditions Algorithm Operation
• Sidewalk stack initialized and started with only one link SID_LINK_TYPE_2.
• No link is in connected state.
• Auto-connect policy is enabled, and auto-connect policy parameters are enabled on all three links.
• Link priority order is SID_LINK_TYPE_1 > SID_LINK_TYPE_2 > SID_LINK_TYPE_3.
• Message sent using sid_put_msg with message transmission attributes of acknowledgment required, retries and time to live set by the developer.
• Message sent using sid_put_msg has link_type set to pick any of the three links. (link_type = (SID_LINK_TYPE_1 | SID_LINK_TYPE_2 | SID_LINK_TYPE_3))
• The payload of the message that is requested to be transmitted can be sent on all the three links.
The Sidewalk stack is started with only one link SID_LINK_TYPE_2.

Even though the auto-connect policy parameters are configured for all links, the auto-connect policy algorithm will function only on one link, in this case SID_LINK_TYPE_2 as the other two links are not started.

If the connection can be established within the time to live of message’s transmit attributes, the message will be sent over SID_LINK_TYPE_2.

Failure to send would result in message failing with SID_ERROR_TIMEOUT error code.

Example 7

Conditions Algorithm Operation
• Sidewalk stack initialized and started with two links (SID_LINK_TYPE_2 | SID_LINK_TYPE_3).
• No link is in connected state.
• Auto-connect policy is enabled, and auto-connect policy parameters are enabled on all three links.
• Link priority order is SID_LINK_TYPE_1 > SID_LINK_TYPE_2 > SID_LINK_TYPE_3.
• Message sent using sid_put_msg with message transmission attributes of acknowledgment required, retries and time to live set by the developer.
• Message sent using sid_put_msg has link_type set to pick any of the three links. (link_type = (SID_LINK_TYPE_1 | SID_LINK_TYPE_2 | SID_LINK_TYPE_3))
• The payload of the message that is requested to be transmitted can be sent on all the three links.
The Sidewalk stack is started with two links SID_LINK_TYPE_2 and SID_LINK_TYPE_3.

Even though the auto-connect policy parameters are configured for all links, the auto-connect policy algorithm will function only on two links, in this case SID_LINK_TYPE_2 and SID_LINK_TYPE_3 as SID_LINK_TYPE_1 is not started.

If the connection can be established within the time to live of message’s transmit attributes, the message will be sent over SID_LINK_TYPE_2 or SID_LINK_TYPE_3.

Failure to send would result in message failing with SID_ERROR_TIMEOUT error code.

Example 8

Conditions Algorithm Operation
• Sidewalk stack initialized and started with two links (SID_LINK_TYPE_2 | SID_LINK_TYPE_3).
• No link is in connected state.
• Auto-connect policy is enabled, and auto-connect policy parameters are enabled on all three links.
• Link priority order is SID_LINK_TYPE_1 > SID_LINK_TYPE_2 > SID_LINK_TYPE_3.
• Message sent using sid_put_msg with message transmission attributes of acknowledgment required, retries and time to live set by the developer.
• Message sent using sid_put_msg has link_type set to pick only one link that is not started. (link_type = SID_LINK_TYPE_1)
• The payload of the message that is requested to be transmitted can be sent on all the three links.
The Sidewalk stack will not attempt connection as the developer has requested the message to be sent on a link SID_LINK_TYPE_1 which is not started.

The message will be immediately failed with error code SID_ERROR_NO_ROUTE_AVAILABLE.

Example 9

Conditions Algorithm Operation
• Sidewalk stack initialized and started with two links (SID_LINK_TYPE_2 | SID_LINK_TYPE_3).
• No link is in connected state.
• Auto-connect policy is enabled, and auto-connect policy parameters are enabled on all three links.
• Link priority order is SID_LINK_TYPE_1 > SID_LINK_TYPE_2 > SID_LINK_TYPE_3.
• Message sent using sid_put_msg with message transmission attributes of acknowledgment required, retries and time to live set by the developer.
• Message sent using sid_put_msg has link_type set to pick any of the three links. (link_type = (SID_LINK_TYPE_1 | SID_LINK_TYPE_2 | SID_LINK_TYPE_3))
• The payload of the message that is requested to be transmitted can be sent only on SID_LINK_TYPE_1, which is not started.
The Sidewalk stack will not attempt connection because the payload is too large for the started links (here, SID_LINK_TYPE_2 and SID_LINK_TYPE_3).

The message will be immediately failed with error code SID_ERROR_NO_ROUTE_AVAILABLE.

Example 10

Conditions Algorithm Operation
• Sidewalk stack initialized and started with all links.
• No link is in connected state.
• Auto-connect policy is disabled on all links.
• Message sent using sid_put_msg with message transmission attributes of acknowledgment required, retries and time to live set by the developer.
• Message sent using sid_put_msg has link_type set to all links. (link_type = (SID_LINK_TYPE_1 | SID_LINK_TYPE_2 | SID_LINK_TYPE_3))
• The payload of the message that is requested to be transmitted can be sent on all the three links.
The Sidewalk stack will not attempt connection as the auto-connect policy parameters are disabled on all links. The message will be immediately failed with error code SID_ERROR_NO_ROUTE_AVAILABLE.

The multi-link connection policy can be enabled at build time by setting the build flag SID_SDK_CONFIG_ENABLE_MULTI_LINK.

The multi-link connection policy determines the message uplink attributes and link connection attributes and does not expect the developer to configure these parameters while sending the message.

The following shows the policies that are available to the developer to configure the multi-link connection policy.

/** multi-link policy modes */
enum sid_link_multi_link_policy {
    /** Default policy, Default Setting, All links are enabled */
    SID_LINK_MULTI_LINK_POLICY_DEFAULT = 0,
    /** Policy optimized for better power consumption */
    SID_LINK_MULTI_LINK_POLICY_POWER_SAVE = 1,
    /** Policy optimized for performance, better throughput */
    SID_LINK_MULTI_LINK_POLICY_PERFORMANCE = 2,
    /** Policy optimized for latency, faster uplinks */
    SID_LINK_MULTI_LINK_POLICY_LATENCY = 3,
    /** Policy optimized for reliability, messages have a longer Time to live
     *  and more retries */
    SID_LINK_MULTI_LINK_POLICY_RELIABILITY = 4,
    /** Delimiter to enum sid_link_multi_link_policy */
    SID_LINK_MULTI_LINK_POLICY_LAST
};

// IOCTL to set multi-link policy

// Set multi-link policy to SID_LINK_MULTI_LINK_POLICY_PERFORMANCE
enum sid_link_multi_link_policy policy =
     SID_LINK_MULTI_LINK_POLICY_PERFORMANCE;
sid_error_t ret = sid_option(handle,
                             SID_OPTION_SET_LINK_POLICY_MULTI_LINK_POLICY,
                             &policy, sizeof(policy));

// IOCTL to get multi-link policy

// Get current configured multi-link policy
enum sid_link_multi_link_policy get_policy;
ret = sid_option(handle,
                 SID_OPTION_GET_LINK_POLICY_MULTI_LINK_POLICY,
                 &get_policy, sizeof(get_policy));

The link connection attributes and message uplink attributes are determined by the multi-link policy and the developer configuration is not used to send the message.

The following table provides the configuration of these attributes for each multi-link policy.

The configuration shown in the below policies cannot be configured by the developer. The configuration is statically encoded in the multi-link policy algorithm.

Link priority for uplink (the same for all multi-link policies):

Link Priority (lower value = higher priority)
Bluetooth LE 0
SubG-FSK 1
SubG-CSS 2

Multi-link Policy: SID_LINK_MULTI_LINK_POLICY_DEFAULT

Description: This multi-link policy has the default behavior of the stack except for configuring the message reliability parameters and connection attributes. The stack does not attempt to keep the connection with the Sidewalk cloud services when there are no messages enqueued to be sent by the stack.

Message Reliability Parameters:

Parameter Bluetooth LE SubG-FSK SubG-CSS
Time to live in seconds 60 120 150
Retries 3 3 3
Transport acknowledgment requested true true true

SID_LINK_TYPE_1 (Bluetooth LE):

Connection Attributes Setting
Link status Enabled
Connection attempt timeout (s) 30
Attempt to connect to gateway (uplink active) false

SID_LINK_TYPE_2 (SubG-FSK):

Connection Attributes Setting
Link status Active
Keep connection with gateway true
Connection attempt timeout (s) 60

SID_LINK_TYPE_3 (SubG-CSS):

Connection Attributes Setting
Link status Active
Connection attempt timeout (s) 60

Multi-link Policy: SID_LINK_MULTI_LINK_POLICY_POWER_SAVE

Description: This multi-link policy stops the links that are enabled by the stack when the stack is not requested to send any messages. The policy behavior is to optimize the power consumption on the device.

Message Reliability Parameters:

Parameter Bluetooth LE SubG-FSK SubG-CSS
Time to live in seconds 60 120 150
Retries 1 1 1
Transport acknowledgment requested true true true

SID_LINK_TYPE_1 (Bluetooth LE):

Connection Attributes Setting
Link status Enabled
Connection attempt timeout (s) 30
Attempt to connect to gateway (uplink active) false

SID_LINK_TYPE_2 (SubG-FSK):

Connection Attributes Setting
Link status Active
Keep connection with gateway false
Connection attempt timeout (s) 60

SID_LINK_TYPE_3 (SubG-CSS):

Connection Attributes Setting
Link status Active
Connection attempt timeout (s) 60

Multi-link Policy: SID_LINK_MULTI_LINK_POLICY_PERFORMANCE

Description: This multi-link policy has the behavior to maximize throughput of the device. The stack attempts to keep at least one of the enabled links connected with the Amazon Sidewalk cloud service. The policy maintains the connected state even when no messages are enqueued.

Message Reliability Parameters:

Parameter Bluetooth LE SubG-FSK SubG-CSS
Time to live in seconds 60 120 120
Retries 1 1 1
Transport acknowledgment requested true true true

SID_LINK_TYPE_1 (Bluetooth LE):

Connection Attributes Setting
Link status Enabled
Connection attempt timeout (s) 30
Attempt to connect to gateway (uplink active) true

SID_LINK_TYPE_2 (SubG-FSK):

Connection Attributes Setting
Link status Active
Keep connection with gateway true
Connection attempt timeout (s) 60

SID_LINK_TYPE_3 (SubG-CSS):

Connection Attributes Setting
Link status Active
Connection attempt timeout (s) 30

Multi-link Policy: SID_LINK_MULTI_LINK_POLICY_LATENCY

Description: This multi-link policy has the behavior to optimize the latency of the uplink messages. For Bluetooth LE and SubG-FSK, the period for which the stack attempts to form a connection with the Amazon Sidewalk cloud services is short compared to the other policies.

Message Reliability Parameters:

Parameter Bluetooth LE SubG-FSK SubG-CSS
Time to live in seconds 30 60 120
Retries 3 3 3
Transport acknowledgment requested true true true

SID_LINK_TYPE_1 (Bluetooth LE):

Connection Attributes Setting
Link status Enabled
Connection attempt timeout (s) 15
Attempt to connect to gateway (uplink active) true

SID_LINK_TYPE_2 (SubG-FSK):

Connection Attributes Setting
Link status Active
Keep connection with gateway true
Connection attempt timeout (s) 30

SID_LINK_TYPE_3 (SubG-CSS):

Connection Attributes Setting
Link status Active
Connection attempt timeout (s) 60

Multi-link Policy: SID_LINK_MULTI_LINK_POLICY_RELIABILITY

Description: This multi-link policy has the policy to optimize for reliable sending of the messages. This policy configures more message retries (5 on every link) and, on SubG-CSS, a longer time to live.

Message Reliability Parameters:

Parameter Bluetooth LE SubG-FSK SubG-CSS
Time to live in seconds 30 120 240
Retries 5 5 5
Transport acknowledgment requested true true true

SID_LINK_TYPE_1 (Bluetooth LE):

Connection Attributes Setting
Link status Enabled
Connection attempt timeout (s) 60
Attempt to connect to gateway (uplink active) false

SID_LINK_TYPE_2 (SubG-FSK):

Connection Attributes Setting
Link status Active
Keep connection with gateway true
Connection attempt timeout (s) 60

SID_LINK_TYPE_3 (SubG-CSS):

Connection Attributes Setting
Link status Active
Connection attempt timeout (s) 120

Preconditions

The following conditions are required to be met for the Sidewalk stack to trigger connection on a link.

  • The link is already started using the sid_start API.
  • The Sidewalk stack is already registered and time is acquired successfully.
  • The link connection policy is configured to SID_LINK_CONNECTION_POLICY_MULTI_LINK_MANAGER. In this case, SID_LINK_MULTI_LINK_POLICY_DEFAULT is used until another multi-link policy is selected.
  • The size of the message that is required to be transmitted is less than the MTU of the links that are started.

Behavior

  • When the size of the message that is required to be transmitted exceeds the MTU of the links that are started, the message is failed with SID_ERROR_NO_ROUTE_AVAILABLE by the sid_put_msg API.
  • The message transmission attributes (time to live, retries, and ack requested) of the connected link are applied to messages enqueued with the sid_put_msg API.
  • If more than one link is connected, the message transmission attributes of the link that has the higher throughput are applied to the message that is enqueued with the sid_put_msg API. For example, if SID_LINK_TYPE_1 and SID_LINK_TYPE_2 are in connected state, the message transmission attributes of SID_LINK_TYPE_1 are applied for the enqueued message.
  • If no link is connected, the message transmission attributes of the link that has the lowest throughput are applied to the message that is enqueued with the sid_put_msg API. For example, if SID_LINK_TYPE_1, SID_LINK_TYPE_2 and SID_LINK_TYPE_3 are enabled, and all the links are in disconnected state, the message that is enqueued with the sid_put_msg API assumes the message transmission attributes of SID_LINK_TYPE_3.
  • If a Sidewalk stack has at least one link in connected state and the connected link can send the message, the multi-link connection policy algorithm is not triggered, because the connected link can send the message.
  • The message uplink attributes and the link_type set in sid_msg_desc by the developer are ignored, and no validation checks are performed on these attributes. The attributes are applied based on the multi-link policy configuration in the policy tables above.
  • Multi-link policy functionality is enabled even when the Amazon Sidewalk stack is compiled with support for only one link or only when one link is initialized and started. When only one link is present, the multi-link policy manager attempts connection only on the link which is enabled.
  • For multi-link connection policies which do not support background connection maintenance, when the connection cannot be established on any of the links on which the policy is enabled, the policy progresses through the links in the order of priority configured in the policy tables, multiple times, until all the messages that are enqueued by the developer’s application have expired. When there are no messages in the end point Amazon Sidewalk stack’s send queue, the algorithm stops attempting to establish connection with the Amazon Sidewalk network.

The following examples are used to explain the behavior of the multi-link connection policy algorithm.

Example 1

Conditions Algorithm Operation
• Sidewalk stack initialized and started with all links.
• At least one link is in connected state, SID_LINK_TYPE_3 is connected.
• Link connection policy is set to SID_LINK_CONNECTION_POLICY_MULTI_LINK_MANAGER, with SID_LINK_MULTI_LINK_POLICY_DEFAULT selected.
• The payload of the message that is requested to be transmitted can be sent on all the three links.
The message transmission attributes (time to live, ack requested, and retries) are applied from SID_LINK_TYPE_3 message attributes of the SID_LINK_MULTI_LINK_POLICY_DEFAULT.

The multi-link connection policy does not attempt connection on any links as the link which is in connected state will send the message on the connected link.

Example 2

Conditions Algorithm Operation
• Sidewalk stack initialized and started with all links.
• No link is in connected state.
• Link connection policy is set to SID_LINK_CONNECTION_POLICY_MULTI_LINK_MANAGER, with SID_LINK_MULTI_LINK_POLICY_RELIABILITY selected.
• The payload of the message that is requested to be transmitted can be sent on all the three links.
The message transmission attributes (time to live, ack requested, and retries) are applied from SID_LINK_TYPE_3 message attributes of the SID_LINK_MULTI_LINK_POLICY_RELIABILITY as no link is connected and the link with lowest throughput capacity is SID_LINK_TYPE_3.

The multi-link connection policy starts attempting link connection for a period of connection timeout specified by the multi-link policy for that link.

During the course of connection attempts, if any of the links connects, the message is sent over the connected link.

If none of the links connects within the time to live in the multi-link policy’s message attributes, the message fails with the SID_ERROR_TIMEOUT error code.

Example 3

Conditions Algorithm Operation
• Sidewalk stack initialized and started with all links.
• SID_LINK_TYPE_1 and SID_LINK_TYPE_2 are in connected state.
• Link connection policy is set to SID_LINK_CONNECTION_POLICY_MULTI_LINK_MANAGER, with SID_LINK_MULTI_LINK_POLICY_RELIABILITY selected.
• The payload of the message that is requested to be transmitted can be sent on all the three links.
The message transmission attributes (time to live, ack requested, and retries) are applied from SID_LINK_TYPE_1 message attributes of the SID_LINK_MULTI_LINK_POLICY_RELIABILITY as SID_LINK_TYPE_1 and SID_LINK_TYPE_2 are in connected state and the link with highest throughput capacity is SID_LINK_TYPE_1.

The multi-link connection policy does not attempt connection on any links as both SID_LINK_TYPE_1 and SID_LINK_TYPE_2 are in connected state and the message will be sent on SID_LINK_TYPE_1.

Example 4

Conditions Algorithm Operation
• Sidewalk stack initialized and started with two links (SID_LINK_TYPE_1 | SID_LINK_TYPE_2).
• No link is in connected state.
• Link connection policy is set to SID_LINK_CONNECTION_POLICY_MULTI_LINK_MANAGER, with SID_LINK_MULTI_LINK_POLICY_POWER_SAVE selected.
• The payload of the message that is requested to be transmitted can be sent on both started links.
The message transmission attributes (time to live, ack requested, and retries) are applied from SID_LINK_TYPE_2 message attributes of the SID_LINK_MULTI_LINK_POLICY_POWER_SAVE as no link is connected and the link with lowest throughput capacity is SID_LINK_TYPE_2.

The multi-link connection policy starts attempting link connection for a period of connection timeout specified by the multi-link policy for that link.

During the course of connection attempts, if any of the links connects, the message is sent over the connected link.

If none of the links connects within the time to live in the multi-link policy’s message attributes, the message fails with the SID_ERROR_TIMEOUT error code.

Example 5

Conditions Algorithm Operation
• Sidewalk stack initialized and started with only one link SID_LINK_TYPE_3.
• No link is in connected state.
• Link connection policy is set to SID_LINK_CONNECTION_POLICY_MULTI_LINK_MANAGER, with SID_LINK_MULTI_LINK_POLICY_PERFORMANCE selected.
• The payload of the message that is requested to be transmitted cannot be transmitted on SID_LINK_TYPE_3.
The Sidewalk stack will not attempt connection because the payload is too large for the started links (here, SID_LINK_TYPE_3).

The message will be immediately failed with error code SID_ERROR_NO_ROUTE_AVAILABLE.

Example 6

Conditions Algorithm Operation
• Sidewalk stack initialized and started with only one link SID_LINK_TYPE_2.
• No link is in connected state.
• Link connection policy is set to SID_LINK_CONNECTION_POLICY_MULTI_LINK_MANAGER, with SID_LINK_MULTI_LINK_POLICY_LATENCY selected.
• The payload of the message that is requested to be transmitted can be transmitted on SID_LINK_TYPE_2.
The Sidewalk stack will attempt connection on SID_LINK_TYPE_2 as this is the only link that is started.

If the link gets connected in the time period present in the message’s uplink attributes, the message is sent successfully, or the message is failed with SID_ERROR_TIMEOUT error code.
3.3.3.7 Background connection maintenance

When the stack is configured with the multi-link policies SID_LINK_MULTI_LINK_POLICY_LATENCY and SID_LINK_MULTI_LINK_POLICY_PERFORMANCE, the algorithm keeps SID_LINK_TYPE_1 connected (uplink active) to the Amazon Sidewalk cloud services by updating the advertisement payload to request a connection. For other policies, the algorithm maintains the default behavior of the link connection policy.

3.4 sid_put_msg behavior with connection policies

When the link connection policy is not configured either to SID_LINK_CONNECTION_POLICY_AUTO_CONNECT or SID_LINK_CONNECTION_POLICY_MULTI_LINK_MANAGER, the sid_put_msg will accept messages only when the Sidewalk stack is registered, time is acquired and at least one of the configured links that the Amazon Sidewalk stack is started with is in connected state.

When either connection policy is enabled, sid_put_msg accepts messages as long as the Sidewalk stack is registered and time is acquired, even if no link is connected.

The Amazon Sidewalk stack queues these messages in its internal queue until the connection policy algorithm establishes a connection.

Send messages with the sid_put_msg API no faster than the throughput of the links on which the connection can be established allows. For example, SID_LINK_TYPE_3 has a lower throughput for sending messages. Enqueuing messages at a rate faster than the link can successfully send messages will cause undefined behavior.