Quantcast
Channel: Zigbee 和 Thread
Viewing all articles
Browse latest Browse all 16963

帖子: RE: 关于z-stack结构体默认对齐方式与强制转换问题,急,求大神回答

$
0
0

 可以不可以这样理解:

MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( SampleApp_TaskID );这个条语句只是接收到一个消息,还不知道是什么消息

switch( MSGpkt->hdr.event )
{
        
  caseKEY_CHANGE: //这里发现是一条按键消息,
    SampleApp_HandleKeys( ((keyChange_t *)MSGpkt)->state, ((keyChange_t *)MSGpkt)->keys );
那么上面接收到的消息的内容就是
typedefstruct
{
  osal_event_hdr_t hdr;
  uint8  state; // shift
  uint8  keys;  // keys
} keyChange_t;
这个结构体的内容,如果按照
typedefstruct
{
  osal_event_hdr_t hdr;     /* OSAL Message header */
  uint16 groupId;           /* Message's group ID - 0 if not set */
  uint16 clusterId;         /* Message's cluster ID */
  afAddrType_t srcAddr;     /* Source Address, if endpoint is STUBAPS_INTER_PAN_EP,
                               it's an InterPAN message */
  uint16 macDestAddr;       /* MAC header destination short address */
  uint8 endPoint;           /* destination endpoint */
  uint8 wasBroadcast;       /* TRUE if network destination was a broadcast address */
  uint8 LinkQuality;        /* The link quality of the received data frame */
  uint8 correlation;        /* The raw correlation value of the received data frame */
  int8  rssi;               /* The received RF power in units dBm */
  uint8 SecurityUse;        /* deprecated */
  uint32 timestamp;         /* receipt timestamp from MAC */
  afMSGCommandFormat_t cmd; /* Application Data */
} afIncomingMSGPacket_t;
这个结构体访问的话,其实中的uint16 groupId;就是
uint8  state; // shift
uint8  keys;  // keys
这两个变量的值?

Viewing all articles
Browse latest Browse all 16963

Trending Articles