# WMPortSendCallback

## Definition

  `#include <nitro/wm.h>`

      typedef struct WMPortSendCallback
      {
          u16             apiid;
          u16             errcode;
          u16             wlCmdID;
          u16             wlResult;
          u16             state;
          u16             port;
          u16             destBitmap;
          u16             restBitmap;
          u16             sentBitmap;
          u16             rsv;
          const u16       *data;
          u16             length;
          u16             seqNo;
          WMCallbackFunc  callback;
          void            *arg;
      } WMPortSendCallback;

## Elements

`apiid` | ID of the API that acts as the source for the callback generation. It is equivalent to the `WMApiid` enumerated type. In this case, it is fixed in `WM_APIID_PORT_SEND`.
`errcode` | Result of the asynchronous process. It is equivalent to the `WMErrCode` enumerated type.
`wlCmdID` | If `errcode` is `WM_ERRCODE_FAILED`, this function will store the ID of the command that was in error in the wireless firmware.
`wlResult` | If `errcode` is `WM_ERRCODE_FAILED`, this function will store the code was the source of the error in the wireless firmware.
`state` | If `errcode` is `WM_ERRCODE_SUCCESS`, the WM Cause Code generated by the callback is stored. Currently, only `WM_STATECODE_PORT_SEND` is generated.
`port` | Port that sends the data.
`destBitmap` | Bitmap of the association IDs (AIDs) assigned to the send destinations.
`restBitmap` | Bitmap of the association IDs (AIDs) of the send destinations for which retries are necessary. The bitmap will not include any AIDs for which it is clear that the send will not succeed for reasons such as disconnection or no connection having been established.
`sentBitmap` | Bitmap of those AIDs for the communications partners to which data was actually sent (among the send destinations designated by `destBitmap`). Although it is guaranteed that the data will have arrived at communications partners included in `sentBitmap`, there is no guarantee that data will not have arrived at communications partners not included in `sentBitmap`.
`rsv` | Reserved.
`data` | Address of the buffer that sent the data.
`length` | Data length that was sent.
`seqNo` | Sequence number.
`callback` | Field that the library uses internally. The address of the called callback function is stored here.
`arg` | Argument that is specified by the `WM_SetPortCallback` function.

## Description

This is a structure passed to the callback function for each of the `WM_SetMPDataToPort`, `WM_SetMPDataToPortEx`, and `WM_SetMPData` functions.

`WM_ERRCODE_SUCCESS` goes in the errcode field if the send was a success, `WM_ERRCODE_SEND_FAILED` goes in if the send failed, and `WM_ERRCODE_SEND_QUEUE_FULL` goes in if the send queue is full. Note that even if the destinations specified with `destBitmap` include AIDs where data cannot be sent to due to a disconnection during the send or a connection not yet existing, `WM_ERRCODE_SUCCESS` will be returned if everything was sent to the remaining communications partners to which data could be sent. Compare the `destBitmap` and the `sentBitmap` to confirm that everything was actually sent to the designated send destinations.

## Revision History

2005/03/04 Initial version.

CONFIDENTIAL