ZigBee中常用的结构体

数据发送:

AF_DataRequest //数据发送函数

typedef struct// afAddrType_t;目的地址结构体变量

typedef enum//afAddrMode_t数据传送类型

typedef struct// endPointDesc_t;设备端点描述符

typedef struct// zAddrType_t;地址变量(长地址或者短地址)

typedef struct// aps_Group_t;组结构体

SimpleDescriptionFormat_t;/* 设备的简单描述符 */

数据接收:

typedef struct //afIncomingMSGPacket_t

typedef struct  //afMSGCommandFormat_t;

typedef struct // osal_event_hdr_t;

typedef struct  //afDataConfirm_t;

typedef struct // ZDO_ActiveEndpointRsp_t;

typedef uint16 cId_t;// 命令结构体:... 

 

数据发送:

发送函数

AF_DataRequest(

afAddrType_t    *dstAddr,  //目的地址结构体变量(含端点)

endPointDesc_t  *srcEP,       //设备端点描述符(源端点描述)                   

unit16  cID,       //串ID    (命令)         

unit16  len,         //有效数据长度              

unit8   *buf,        //数据

unit8   *transID,              

unit8   *options,              

unit8     radius,

)

例子:

AF_DataRequest( &SampleApp_Flash_DstAddr,

&SampleApp_epDesc,

              SAMPLEAPP_FLASH_CLUSTERID,

               2,

               buffer,

              &SampleApp_TransID,

               AF_DISCV_ROUTE,

              AF_DEFAULT_RADIUS )

 

typedef struct// afAddrType_t;目的地址结构体变量

{

 union

  {

   uint16      shortAddr;

   ZLongAddr_t extAddr;

  }addr;

  afAddrMode_t addrMode;//afAddrMode_t是一个枚举类型模式参数

 byte endPoint;//指定的端点号 端点241—254保留端点 范围 1-240

 uint16 panId;  // used for theINTER_PAN feature

afAddrType_t;     //目的地址结构体变量(含端点)

 

例:afAddrType_t   SampleApp_Flash_DstAddr;

      /* 设置闪烁命令的目的地址(发送给组1的所有成员)*/

  SampleApp_Flash_DstAddr.addrMode= (afAddrMode_t) afAddrGroup;

 SampleApp_Flash_DstAddr.endPoint = SAMPLEAPP_ENDPOINT;

 SampleApp_Flash_DstAddr.addr.shortAddr = SAMPLEAPP_FLASH_GROUP;

 

typedef  enum//afAddrMode_t数据传送类型

{

afAddrNotPresent  =  AddrNotPresent,    //间接传送(Indirect)

afAddr16Bit  =  Addr16Bit,                   //指定地址单点传送(Unicast)  16位

afAddrGroup  =  AddrGroup,                 //组寻址(Group Addressing)

afAddrBroadcast  =  AddrBroadcast        //广播传送(broadcast)

afAddrMode_t;//数据传送类型

 

typedef struct// endPointDesc_t;设备端点描述符

{

 byte  endPoint;

 byte *task_id;          // Pointer to location of theApplication task ID.

 SimpleDescriptionFormat_t *simpleDesc;        //设备简单描述符

 afNetworkLatencyReq_t  latencyReq;

endPointDesc_t;//设备端点描述符

例:

      endPointDesc_tSampleApp_epDesc;

      /* 填充端点描述符 */

  SampleApp_epDesc.endPoint =SAMPLEAPP_ENDPOINT;

  SampleApp_epDesc.task_id =&SampleApp_TaskID;

  SampleApp_epDesc.simpleDesc

            =(SimpleDescriptionFormat_t *)&SampleApp_SimpleDesc;

  SampleApp_epDesc.latencyReq= noLatencyReqs;

 

typedef struct// zAddrType_t;地址变量(长地址或者短地址)

{

 union

  {

   uint16         shortAddr;

   ZLongAddr_t   extAddr;

  }addr;

 byte addrMode;

zAddrType_t;  //地址变量(长地址或者短地址)

 

typedef struct// aps_Group_t;组结构体

{

 uint16 ID;                      // Unique to this table

 uint8  name[APS_GROUP_NAME_LEN];// Human readable name of group

aps_Group_t;  //组结构体

 

 

SimpleDescriptionFormat_t;/*设备的简单描述符 */

 

typedef struct

{

  byte EndPoint;                              //EP ID (EP=End Point)

  uint16 AppProfId;                  // profile ID(剖面ID)

  uint16 AppDeviceId;               // Device ID

  byte AppDevVer:4;                //Device Version 0x00 为 Version 1.0

  byte Reserved:4;                     // AF_V1_SUPPORT uses for AppFlags:4.

  byte AppNumInClusters;                //终端支持的输入簇的个数

  cId_t*pAppInClusterList;         //指向输入Cluster ID列表的指针

  byte AppNumOutClusters;         //输出簇的个数

  cId_t *pAppOutClusterList;     //指向输出Cluseter ID列表的指针

SimpleDescriptionFormat_t;

例子:

const SimpleDescriptionFormat_tSampleApp_SimpleDesc =

{

 SAMPLEAPP_ENDPOINT,             //  端点号

 SAMPLEAPP_PROFID,                 // Profile ID

 SAMPLEAPP_DEVICEID,               //  设备ID

  SAMPLEAPP_DEVICE_VERSION,        // 设备版本

 SAMPLEAPP_FLAGS,                  //  标识

 SAMPLEAPP_MAX_CLUSTERS,         // 输入簇的数量

 (cId_t *)SampleApp_ClusterList,                //  输入簇列表

 SAMPLEAPP_MAX_CLUSTERS,          //  输出簇的数量

 (cId_t *)SampleApp_ClusterList                  //  输出簇列表

};

 

数据接收:

typedef struct  //afIncomingMSGPacket_t

{

 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 isSTUBAPS_INTER_PAN_EP,

                               it's an InterPANmessage */

 uint16  macDestAddr;       /* MAC header destination short address*/

 uint8  endPoint;           /* destination endpoint */

 uint8  wasBroadcast;       /* TRUE if network destination was abroadcast address */

 uint8  LinkQuality;        /* The link quality of the receiveddata frame */

 uint8  correlation;        /* The raw correlation value of thereceived data frame */

 int8   rssi;               /* The received RF power inunits dBm */

 uint8  SecurityUse;        /* deprecated */

 uint32 timestamp;         /*receipt timestamp from MAC */

 afMSGCommandFormat_t  cmd; /*Application Data */

afIncomingMSGPacket_t;

//afIncomingMSGPacket_t  gtwRxFromNode;

 

// Generalized MSG Command Format

typedef struct  // afMSGCommandFormat_t;

{

 byte   TransSeqNumber;

 uint16 DataLength;              // Number of bytes in TransData

 byte  *Data;

afMSGCommandFormat_t;

 

typedef struct //osal_event_hdr_t; 

{

 uint8  event;

 uint8  status;

osal_event_hdr_t;       

 

 

typedef struct  //afDataConfirm_t;

{

 osal_event_hdr_t hdr;

 byte endpoint;

 byte transID;

}afDataConfirm_t;

 

typedef struct // ZDO_ActiveEndpointRsp_t;

{

 uint8   status;

 uint16  nwkAddr;   // Network address of interest

 uint8   cnt;

 uint8   epList[];

ZDO_ActiveEndpointRsp_t;

 

 

typedef uint16  cId_t;//命令结构体:

// Simple Description Format Structure

### 回答1: CentOS 7启动httpd服务失败可能有多种原因,以下是一些常见的解决方法: 1. 检查httpd配置文件是否正确:可以使用命令`httpd -t`检查httpd配置文件是否正确,如果有错误,需要修改配置文件。 2. 检查端口是否被占用:可以使用命令`netstat -tlnp`查看端口是否被占用,如果被占用需要释放端口或修改httpd配置文件中的端口号。 3. 检查httpd服务是否安装:可以使用命令`rpm -qa | grep httpd`查看httpd服务是否安装,如果没有安装需要先安装httpd服务。 4. 检查httpd服务是否启动:可以使用命令`systemctl status httpd`查看httpd服务是否启动,如果没有启动需要使用命令`systemctl start httpd`启动httpd服务。 5. 检查SELinux是否开启:如果SELinux开启,可能会导致httpd服务启动失败,需要使用命令`setenforce 0`关闭SELinux,或者修改SELinux策略。 以上是一些常见的解决方法,如果以上方法都无法解决问题,可以查看httpd服务日志文件,找到具体的错误信息,然后根据错误信息进行解决。 ### 回答2: CentOS 7上的httpd服务启动失败可能有多种原因。以下列出了一些常见问题和解决方法: 1. 端口被占用 当httpd试图占用已被其他程序占用的端口时会启动失败。此时可以通过使用`netstat -tunlp`命令检查端口占用情况,然后杀死占用该端口的进程及时释放端口。或者修改httpd的配置文件,将端口修改为未被占用的端口。 2. 配置文件错误 有时httpd服务的配置文件中可能出现错误,例如语法错误或路径错误等等。在启动httpd服务之前,可以使用`apachectl configtest`命令进行检查,如果输出“Syntax OK”,则表示配置文件没有错误。如果出现错误,则需要根据错误提示进行相应修改。 3. 依赖关系问题 如果httpd依赖的其他程序或库缺失,也会导致启动失败。可以通过使用`systemctl status httpd.service`命令来查看httpd服务状态,如果输出“Failed to start”或“Loaded: failed”,则需要检查依赖关系是否完整。 4. SELinux问题 当SELinux启用时,有时会导致httpd服务启动失败。在这种情况下,可以在SELinux上禁用httpd服务,或者修改httpd配置文件解决SELinux相关的问题。 5. 用户权限问题 httpd服务启动可能需要特定的用户权限。如果使用的用户权限不够,则无法启动。可以尝试使用root用户启动httpd服务,或者根据需要修改相应的用户权限。 ### 回答3: CentOS 7中的Apache HTTP服务器(httpd)是一个常见的Web服务器,如果遇到httpd服务启动失败的情况,可能会影响服务器正常的工作和对外服务的稳定性。本文将提供一些可能会导致httpd服务启动失败的原因,并给出相应的解决方法。 1. 端口被占用 如果端口被其他进程占用,httpd服务就无法启动。可以通过 netstat -tulpn 命令查看端口占用情况,并杀死占用该端口的进程。如果端口被 httpd 服务自身占用,可以通过 systemctl restart httpd 命令重启 httpd 服务;如果是其他进程占用了端口,可以通过 kill 命令杀死该进程或更改 httpd.conf 文件配置,将 httpd 服务的端口改为其他空闲端口,重新启动。 2. 配置文件错误 httpd 服务的配置文件通常是 /etc/httpd/conf/httpd.conf,如果其中存在语法错误、权限问题或者其它配置错误,可能会导致 httpd 服务启动出错。可以通过将 httpd.conf 文件备份后删掉,重新执行 yum install httpd 命令安装 httpd 服务,然后手动修改 httpd.conf 文件,逐个检查每个配置项是否正确,确认无误后重启 httpd 服务。 3. SELinux 问题 SELinux 是 CentOS 7中提供的一种安全模块,它可以对系统文件和应用程序进行安全管控。如果 SELinux 配置不正确,可能会阻止 httpd 服务正常启动。可以通过修改 /etc/selinux/config 文件中 SELINUX=disabled 来暂时关闭 SELinux,然后重新启动 httpd 服务;或者一个更优的方式是,根据日志确定问题原因,使用命令 semanage 或者 setsebool 等工具将相关目录或者配置加入到 SELinux 许可列表中,重新启动 httpd 服务,以恢复服务正常工作。 4. 防火墙问题 如果你的 CentOs 7 服务器启用了防火墙,有可能会导致 httpd 服务启动失败。可以通过检查防火墙相关配置来确定问题原因,解决方案是修改防火墙规则,将端口 80 或者 443 等 httpd 服务需要的端口放行,重新启动 httpd 服务。 总之,当遇到 httpd 服务启动失败时,不要慌张,可以先通过日志或者执行命令查看错误信息,找到错误原因,然后根据错误原因一步一步解决问题。在解决问题过程中注意备份原始配置文件,以免造成不必要的损失。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DreamingCatcher

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值