1 //******************************************************************
3 // Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 * This API only works with:
30 #ifndef TELEGESISWRAPPER_H_
31 #define TELEGESISWRAPPER_H_
46 * Defines a cluster id.
51 char clusterId[SIZE_CLUSTERID];
56 * Defines a list of ZigBee device's clusters.
61 TWClusterId* clusterIds;
67 * Defines an endpoint of a ZigBee device.
72 char endpointId[SIZE_ENDPOINTID];
73 TWClusterList* clusterList;
78 * Defines a list of endpoints of a ZigBee device.
83 TWEndpoint* endpoints;
89 * Defines a discovered ZigBee device.
95 char nodeId[SIZE_NODEID];
96 TWEndpoint* endpointOfInterest;
101 * Defines a ZigBee device list.
106 TWDevice* deviceList;
112 * Defines a ZigBee device update.
117 char nodeId[SIZE_NODEID];
118 char endpoint[SIZE_ENDPOINTID];
119 char status[SIZE_ZONESTATUS];
120 char extendedStatus[SIZE_ZONESTATUS_EXTENDED];
121 char zoneId[SIZE_ZONEID]; //optional
122 char delay[SIZE_UPDATE_DELAY_TIME]; //optional - amount of time in quarter of seconds
127 char zoneId[SIZE_ZONEID];
128 char zoneType[SIZE_ZONETYPE];
132 typedef void (*TWDeviceFoundCallback)(TWDevice* device);
133 typedef void (*TWEnrollmentSucceedCallback)(TWEnrollee* enrollee);
134 typedef void (*TWDeviceStatusUpdateCallback)(TWUpdate* update);
135 typedef void (*TWDeviceNodeIdChangedCallback)(const char* eui, const char* nodeId);
139 * Initializes the Telegesis module.
141 * @param[in] deviceDevPath The device path at which this Telegesis module exists.
144 OCStackResult TWInitialize(PIPlugin_Zigbee* plugin, const char* deviceDevPath);
148 * Initiates necessary operations to find ZigBee devices.
149 * @param[in] plugin The plugin instance to operate with.
152 OCStackResult TWDiscover(PIPlugin_Zigbee* plugin);
156 * Gets a value at the specified parameters.
158 * @param[in] extendedUniqueId The extended unique id of the device.
159 * @param[in] nodeId The node id of the device.
160 * @param[in] endpointId The endpoint id from which the attribute belongs.
161 * @param[in] clusterId The cluster id from which the attribute belongs.
162 * @param[in] attributeId The attribute id from which the attribute belongs.
163 * @param[out] outValue The value at the specified attribute.
164 * @param[out] outValueLength The length of the value.
165 * @param[in] plugin The plugin instance to operate with.
168 OCStackResult TWGetAttribute(char* extendedUniqueId, char* nodeId, char* endpointId,
169 char* clusterId, char* attributeId,
170 char** outValue, uint8_t* outValueLength,
171 PIPlugin_Zigbee* plugin);
175 * Sets a value at the specified parameters.
177 * @param[in] extendedUniqueId The extended unique id of the device.
178 * @param[in] nodeId The node id of the device.
179 * @param[in] endpointId The endpoint id from which the attribute belongs.
180 * @param[in] clusterId The cluster id from which the attribute belongs.
181 * @param[in] attributeId The attribute id from which the attribute belongs.
182 * @param[in] attributeType The attribute type of the attribute.
183 * @param[in] newValue The value to set at the specified attribute.
184 * @param[in] plugin The plugin instance to operate with.
187 OCStackResult TWSetAttribute(char* extendedUniqueId, char* nodeId, char* endpointId,
188 char* clusterId, char* attributeId, char* attributeType,
189 char* newValue, PIPlugin_Zigbee* plugin);
193 * Switches a device to On/Off.
195 * @param[in] nodeId The node id of the device.
196 * @param[in] endpointId The endpoint id from which the attribute belongs.
197 * @param[in] newState Use "0" for OFF, "1" for ON, NULL for toggling.
198 * @param[in] plugin The plugin instance to operate with.
201 OCStackResult TWSwitchOnOff(char* nodeId, char* endpointId, char* newState,
202 PIPlugin_Zigbee* plugin);
206 * Move to a level. All parameters are null-terminated.
208 * @param[in] nodeId The node id of the device.
209 * @param[in] endpointId The endpoint id from which the attribute belongs.
210 * @param[in] onOfState A boolean type number represents if the command
211 * is used with On/Off. If it is set to 0, it means the command is
212 * implemented as Move to Level command. If it is set to 1, it
213 * means the command will be implemented Move to Level
214 * (with On/Off) command.
216 * @param[in] level The The meaning of ‘level’ is device dependent
217 * e.g. for a light it may mean brightness level.
219 * @param[in] transTime The time taken to move to the new level.
220 * @param[in] plugin The plugin instance to operate with.
223 OCStackResult TWMoveToLevel(char* nodeId, char* endpointId,
224 char* onOffState, char* level, char* transTime,
225 PIPlugin_Zigbee* plugin);
229 * Switches door lock state.
231 * @param[in] nodeId The node id of the device.
232 * @param[in] endpointId The endpoint id from which the attribute belongs.
233 * @param[in] newState Use "0" to Unlock, "1" to Lock ON.
234 * @param[in] plugin The plugin instance to operate with.
237 OCStackResult TWSwitchDoorLockState(char* nodeId, char* endpointId, char* newState,
238 PIPlugin_Zigbee* plugin);
242 * Move Color Temperature
244 * @param[in] nodeId The node id of the device.
245 * @param[in] endpointId The endpoint id from which the attribute belongs.
246 * @param[in] colorTemperature 16 bit hexadecimal number.
247 * @param[in] transTime The time taken to move to the new level.
248 * @param[in] plugin The plugin instance to operate with.
251 OCStackResult TWColorMoveToColorTemperature(char* nodeId, char* endpointId,
252 char* colorTemperature, char* transTime,
253 PIPlugin_Zigbee* plugin);
257 * Sets discovery callback.
258 * This callback will be called when TWDiscover() discovers ZigBee device(s).
261 OCStackResult TWSetDiscoveryCallback(const TWDeviceFoundCallback callback,
262 PIPlugin_Zigbee* plugin);
266 * Sets end device's nodeId changed callback.
267 * This callback will be called when there is a NodeId change for a remote ZigBee device.
270 OCStackResult TWSetEndDeviceNodeIdChangedCallback(TWDeviceNodeIdChangedCallback callback,
271 PIPlugin_Zigbee* plugin);
275 * Sets status update callback.
276 * This callback will be called when there is an update on remote ZigBee devices.
279 OCStackResult TWSetStatusUpdateCallback(TWDeviceStatusUpdateCallback callback,
280 PIPlugin_Zigbee* plugin);
284 * Attempts to listen to status change updates of a remote zone device.
285 * A callback TWEnrollSucceedCallback will be invoked when this registration is fulfill.
286 * @param[in] nodeId The node id of the remote zone device.
287 * @param[in] endpointId The node id of the remote zone device.
288 * @param[in] plugin The plugin instance to operate with.
292 OCStackResult TWListenForStatusUpdates(char* nodeId, char* endpointId, PIPlugin_Zigbee* plugin);
297 * @param[in] plugin The plugin instance to operate with.
300 OCStackResult TWProcess(PIPlugin_Zigbee* plugin);
304 * Uninitializes the Telegesis module.
305 * @param[in] plugin The plugin instance to operate with.
308 OCStackResult TWUninitialize(PIPlugin_Zigbee* plugin);
313 #endif // __cplusplus
315 #endif /* TELEGESISWRAPPER_H_ */