e9e0b82f965faffdd2ea59012c1c5cdd56fc64e4
1 /*
2 * zllSocCmd.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 {
45 #endif
47 #include <stdint.h>
49 /********************************************************************/
50 // ZLL Soc Types
52 // Endpoint information record entry
53 typedef struct
54 {
55 uint8_t IEEEAddr[8];
56 uint16_t nwkAddr; // Network address
57 uint8_t endpoint; // Endpoint identifier
58 uint16_t profileID; // Profile identifier
59 uint16_t deviceID; // Device identifier
60 uint8_t version; // Version
61 char* deviceName;
62 uint8_t status;
63 } epInfo_t;
65 typedef uint8_t (*zllSocTlIndicationCb_t)(epInfo_t *epInfo);
66 typedef uint8_t (*zllNewDevIndicationCb_t)(epInfo_t *epInfo);
67 typedef uint8_t (*zllSocZclGetStateCb_t)(uint8_t state, uint16_t nwkAddr, uint8_t endpoint);
68 typedef uint8_t (*zllSocZclGetLevelCb_t)(uint8_t level, uint16_t nwkAddr, uint8_t endpoint);
69 typedef uint8_t (*zllSocZclGetHueCb_t)(uint8_t hue, uint16_t nwkAddr, uint8_t endpoint);
70 typedef uint8_t (*zllSocZclGetSatCb_t)(uint8_t sat, uint16_t nwkAddr, uint8_t endpoint);
72 typedef struct
73 {
74 zllSocTlIndicationCb_t pfnTlIndicationCb; // TouchLink Indication callback
75 zllNewDevIndicationCb_t pfnNewDevIndicationCb; // New device Indication callback
76 zllSocZclGetStateCb_t pfnZclGetStateCb; // ZCL response callback for get State
77 zllSocZclGetLevelCb_t pfnZclGetLevelCb; // ZCL response callback for get Level
78 zllSocZclGetHueCb_t pfnZclGetHueCb; // ZCL response callback for get Hue
79 zllSocZclGetSatCb_t pfnZclGetSatCb; // ZCL response callback for get Sat
80 } zllSocCallbacks_t;
82 #define Z_EXTADDR_LEN 8
84 typedef enum
85 {
86 afAddrNotPresent = 0,
87 afAddrGroup = 1,
88 afAddr16Bit = 2,
89 afAddr64Bit = 3,
90 afAddrBroadcast = 15
91 } afAddrMode_t;
93 /********************************************************************/
94 // ZLL Soc API
96 //configuration API's
97 int32_t zllSocOpen( char *devicePath );
98 void zllSocRegisterCallbacks( zllSocCallbacks_t zllSocCallbacks);
99 void zllSocClose( void );
100 void zllSocProcessRpc (void);
102 //ZLL API's
103 void zllSocTouchLink(void);
104 void zllSocResetToFn(void);
105 void zllSocSendResetToFn(void);
106 void zllSocOpenNwk(void);
107 //ZCL Set API's
108 void zllSocSetState(uint8_t state, uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
109 void zllSocSetLevel(uint8_t level, uint16_t time, uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
110 void zllSocSetHue(uint8_t hue, uint16_t time, uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
111 void zllSocSetSat(uint8_t sat, uint16_t time, uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
112 void zllSocSetHueSat(uint8_t hue, uint8_t sat, uint16_t time, uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
113 void zllSocAddGroup(uint16_t groupId, uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
114 void zllSocStoreScene(uint16_t groupId, uint8_t sceneId, uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
115 void zllSocRecallScene(uint16_t groupId, uint8_t sceneId, uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
116 void zllSocBind(uint16_t srcNwkAddr, uint8_t srcEndpoint, uint8_t srcIEEE[8], uint8_t dstEndpoint, uint8_t dstIEEE[8], uint16_t clusterID);
117 //ZCL Get API's
118 void zllSocGetState(uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
119 void zllSocGetLevel(uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
120 void zllSocGetHue(uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
121 void zllSocGetSat(uint16_t dstAddr, uint8_t endpoint, uint8_t addrMode);
122 #ifdef __cplusplus
123 }
124 #endif
126 #endif /* ZLLSOCCMD_H */