]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - iot-gateway/lighting-gateway.git/blob - zbSocDriver/zbSocCmd.h
Fixed boot command to work with old and new bootloader
[iot-gateway/lighting-gateway.git] / zbSocDriver / zbSocCmd.h
1 /*
2  * zbSocCmd.h
3  *
4  * This module contains the API for the zll SoC Host Interface.
5  *
6  * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ 
7  * 
8  * 
9  *  Redistribution and use in source and binary forms, with or without 
10  *  modification, are permitted provided that the following conditions 
11  *  are met:
12  *
13  *    Redistributions of source code must retain the above copyright 
14  *    notice, this list of conditions and the following disclaimer.
15  *
16  *    Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the 
18  *    documentation and/or other materials provided with the   
19  *    distribution.
20  *
21  *    Neither the name of Texas Instruments Incorporated nor the names of
22  *    its contributors may be used to endorse or promote products derived
23  *    from this software without specific prior written permission.
24  *
25  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
26  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
27  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
29  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
30  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
31  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
34  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
35  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37  */
39 #ifndef ZLLSOCCMD_H
40 #define ZLLSOCCMD_H
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 #include <stdint.h>
48 /********************************************************************/
49 // ZLL Soc Types
50 typedef enum
51 {
52   afAddrNotPresent = 0,
53   afAddrGroup      = 1,
54   afAddr16Bit      = 2,
55   afAddr64Bit      = 3,
56   afAddrBroadcast  = 15
57 } afAddrMode_t;
59 #define Z_EXTADDR_LEN 8
61 // Endpoint information record entry
62 typedef struct {
63         uint8_t IEEEAddr[8];
64         uint16_t nwkAddr; // Network address
65         uint8_t endpoint; // Endpoint identifier
66         uint16_t profileID; // Profile identifier
67         uint16_t deviceID; // Device identifier
68         uint8_t version; // Version
69         char* deviceName;
70         uint8_t status;
71   uint8_t flags;
72 } epInfo_t;
74 typedef struct
75 {
76         epInfo_t * epInfo;
77         uint16_t prevNwkAddr;   // Precious network address
78         uint8_t type;   // new / updated / old
79 } epInfoExtended_t;
81 #define EP_INFO_TYPE_EXISTING 0
82 #define EP_INFO_TYPE_NEW 1
83 #define EP_INFO_TYPE_UPDATED 2
84 #define EP_INFO_TYPE_REMOVED 4
86 typedef uint8_t (*zbSocTlIndicationCb_t)(epInfo_t *epInfo);
87 typedef uint8_t (*zllNewDevIndicationCb_t)(epInfo_t *epInfo);
88 typedef uint8_t (*zbSocZclGetStateCb_t)(uint8_t state, uint16_t nwkAddr,
89                 uint8_t endpoint);
90 typedef uint8_t (*zbSocZclGetLevelCb_t)(uint8_t level, uint16_t nwkAddr,
91                 uint8_t endpoint);
92 typedef uint8_t (*zbSocZclGetHueCb_t)(uint8_t hue, uint16_t nwkAddr,
93                 uint8_t endpoint);
94 typedef uint8_t (*zbSocZclGetSatCb_t)(uint8_t sat, uint16_t nwkAddr,
95                 uint8_t endpoint);
96 typedef uint8_t (*zdoSimpleDescRspCb_t)(epInfo_t *epInfo);
97 typedef uint8_t (*zdoLeaveIndCb_t)(uint16_t nwkAddr);
98 typedef uint8_t (*utilGetDevInfoRspcb_t) (uint8_t status, uint16_t nwkAddr, uint8_t ieeeAddr[8], uint8_t devType, uint8_t devState);
99 typedef uint8_t (*zbSocZclGetModelCb_t)(uint8_t *ModelId);
101 typedef struct {
102         zbSocTlIndicationCb_t pfnTlIndicationCb; // TouchLink Indication callback
103         zllNewDevIndicationCb_t pfnNewDevIndicationCb; // New device Indication callback
104         zbSocZclGetStateCb_t pfnZclGetStateCb; // ZCL response callback for get State
105         zbSocZclGetLevelCb_t pfnZclGetLevelCb; // ZCL response callback for get Level
106         zbSocZclGetHueCb_t pfnZclGetHueCb; // ZCL response callback for get Hue
107         zbSocZclGetSatCb_t pfnZclGetSatCb; // ZCL response callback for get Sat
108         zdoSimpleDescRspCb_t pfnZdoSimpleDescRspCb; // ZCL callback for simple desc response
109         zdoLeaveIndCb_t pfnZdoLeaveIndCb; // ZCL callback for simple desc response
110         utilGetDevInfoRspcb_t pfnUtilGetDevInfoRsp;
111         zbSocZclGetModelCb_t pfnZclGetModelCb; //
112 } zbSocCallbacks_t;
115 /********************************************************************/
116 // ZLL Soc API
117 //configuration API's
118 int32_t zbSocOpen(char *devicePath);
119 void zbSocRegisterCallbacks(zbSocCallbacks_t zbSocCallbacks);
120 void zbSocClose(void);
121 void zbSocProcessRpc(void);
123 //ZLL API's
124 void zbSocTouchLink(void);
125 void zbSocResetToFn(void);
126 void zbSocSendResetToFn(void);
127 void zbSocOpenNwk(uint8_t duration);
128 void zbSocBridgeStartNwk(void);
130 //ZCL Set API's
131 void zbSocSetState(uint8_t state, uint16_t dstAddr, uint8_t endpoint,
132                 uint8_t addrMode);
133 void zbSocSetLevel(uint8_t level, uint16_t time, uint16_t dstAddr,
134                 uint8_t endpoint, uint8_t addrMode);
135 void zbSocSetHue(uint8_t hue, uint16_t time, uint16_t dstAddr,
136                 uint8_t endpoint, uint8_t addrMode);
137 void zbSocSetSat(uint8_t sat, uint16_t time, uint16_t dstAddr,
138                 uint8_t endpoint, uint8_t addrMode);
139 void zbSocSetHueSat(uint8_t hue, uint8_t sat, uint16_t time, uint16_t dstAddr,
140                 uint8_t endpoint, uint8_t addrMode);
141 void zbSocAddGroup(uint16_t groupId, uint16_t dstAddr, uint8_t endpoint,
142                 uint8_t addrMode);
143 void zbSocStoreScene(uint16_t groupId, uint8_t sceneId, uint16_t dstAddr,
144                 uint8_t endpoint, uint8_t addrMode);
145 void zbSocRecallScene(uint16_t groupId, uint8_t sceneId, uint16_t dstAddr,
146                 uint8_t endpoint, uint8_t addrMode);
147 void zbSocBind(uint16_t srcNwkAddr, uint8_t srcEndpoint, uint8_t srcIEEE[8],
148                 uint8_t dstEndpoint, uint8_t dstIEEE[8], uint16_t clusterID);
149 void zbSocSendIdentify(uint16_t identifyTime, uint16_t dstAddr,
150                 uint8_t endpoint, uint8_t addrMode);
151 void zbSocSendIdentifyEffect(uint8_t effect, uint8_t effectVarient, uint16_t dstAddr,
152                 uint8_t endpoint, uint8_t addrMode);
153 void zbSocGetInfo(void);
154 void zbSocGetModel(uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
156 //ZCL Get API's
157 void zbSocGetState(uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
158 void zbSocGetLevel(uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
159 void zbSocGetHue(uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
160 void zbSocGetSat(uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
161 #ifdef __cplusplus
163 #endif
165 #endif /* ZLLSOCCMD_H */