单播
- 网络ID进行单播
apsFrame.profileId = PROFILE_ID; // profile unique to this app
apsFrame.clusterId = MSG_SINK_ADVERTISE;
apsFrame.sourceEndpoint = ENDPOINT; // sensor endpoint
apsFrame.destinationEndpoint = ENDPOINT; // sensor endpoint
apsFrame.options = EMBER_APS_OPTION_RETRY;
/** @brief Sends a unicast message as per the ZigBee specification.
*
* The message will arrive at its destination only if there is a known route
* to the destination node. Setting the ::ENABLE_ROUTE_DISCOVERY
* option will cause a route to be discovered if none is known. Setting the
* ::FORCE_ROUTE_DISCOVERY option will force route discovery.
* Routes to end-device children of the local node are always known.
*
* Setting the @c APS_RETRY option will cause the message to be
* retransmitted until either a matching acknowledgement is received or three
* transmissions have been made.
*
* @note Using the ::FORCE_ROUTE_DISCOVERY option will cause the first
* transmission to be consumed by a route request as part of discovery, so
* the application payload of this packet will not reach its destination on
* the first attempt. If you want the packet to reach its destination, the
* APS_RETRY option must be set so that another attempt is made to transmit
* the message with its application payload after the route has been
* constructed.
*
* Setting the ::DESTINATION_EUI64 option will cause the long
* ID of the destination to be included in the network header. This is
* the only way to absolutely guarantee that the message is delivered to
* the correct node. Without it, a message may on occasion be delivered
* to the wrong destination in the event of an id conflict that has
* not yet been detected and resolved by the network layer.
*
* @note When sending fragmented messages, the stack will only assign a new APS
* sequence number for the first fragment of the message (i.e.,
* ::EMBER_APS_OPTION_FRAGMENT is set and the low-order byte of the groupId
* field in the APS frame is zero). For all subsequent fragments of the same
* message, the application must set the sequence number field in the APS frame
* to the sequence number assigned by the stack to the first fragment.
*
* @param type Specifies the outgoing message type. Must be one of
* ::EMBER_OUTGOING_DIRECT, ::EMBER_OUTGOING_VIA_ADDRESS_TABLE, or
* ::EMBER_OUTGOING_VIA_BINDING.
*
* @param indexOrDestination Depending on the type of addressing used, this
* is either the EmberNodeId of the destination, an index into the address table,
* or an index into the binding table.
*
* @param apsFrame The APS frame which is to be added to the message.
*
* @param message Contents of the message.
*
* @return An ::EmberStatus value. For any result other than
* ::EMBER_SUCCESS, the message will not be sent.
* - ::EMBER_SUCCESS - The message has been submitted for transmission.
* - ::EMBER_INVALID_BINDING_INDEX - The \c bindingTableIndex
* refers to a non-unicast binding.
* - ::EMBER_NETWORK_DOWN - The node is not part of a network.
* - ::EMBER_MESSAGE_TOO_LONG - The message is too large to
* fit in a MAC layer frame.
* - ::EMBER_MAX_MESSAGE_LIMIT_REACHED - The
* ::EMBER_APS_UNICAST_MESSAGE_COUNT limit has been reached.
*/
EmberStatus emberSendUnicast(EmberOutgoingMessageType type,
int16u indexOrDestination,
EmberApsFrame *apsFrame,
EmberMessageBuffer message);
- Interpan点播
EmberStatus emberAfSendInterPan(EmberPanId panId,
const EmberEUI64 eui64,
EmberNodeId nodeId,
EmberMulticastId multicastId,
EmberAfClusterId clusterId,
EmberAfProfileId profileId,
int16u messageLength,
int8u* messageBytes)