# WMPortRecvCallback

## C Specification

      #include <nitro/wm.h>

      typedef struct WMPortRecvCallback
      {
          u16             apiid;
          u16             errcode;
          u16             state;
          u16             port;
          WMMpRecvBuf*    recvBuf;
          u16*            data;
          u16             length;
          u16             aid;
          u8              macAddress[6];
          u16             seqNo;
          void*           arg;

      } WMPortRecvCallback;

## Description

The structure that is passed to the callback function is set by the `WM_SetPortCallback` function.

## Arguments

`apiid` | Specifies the API ID that is responsible for callback generation. This argument is the same as the `WMApiid` enumerated type. This argument is fixed to `WM_APIID_PORT_RECV`.
`errcode` | Specifies the results of asynchronous processing. This argument is the same as the `WMErrCode` enumerated type.
`state` | When errcode is `WM_ERRCODE_SUCCESS`, the trigger class that generated the callback is stored. The following three triggers can be generated: `WM_STATECODE_PORT_RECV`, `WM_STATECODE_CONNECTED`, `WM_STATECODE_DISCONNECTED`.
`port` | Stores the port that received the data.
`recvBuf` | This member was prepared for compatibility with `WMStartMPCallback`.
`data` | Stores the address of the buffer that received the data.
`length` | Stores the length of the received data.
`aid` | Stores the AID of the terminal of the source that sent the received data.
`macAddress` | When the state is `WM_STATECODE_CONNECTED` or `WM_STATECODE_DISCONNECTED`, stores the MAC address of the connected or disconnected child.
`seqNo` | Stores the sequence number.
`arg` | Stores the argument that is specified by the `WM_SetPortCallback` function.

## Revision History

10/05/2004 Standardized MAC address as `u8` type
09/13/2004 Changed `WM_STATECODE_CHILD_CONNECTED` to `WM_STATECODE_CONNECTED`
08/11/2004 Initial version