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);
138 * Initializes the Telegesis module.
140 * @param[in] deviceDevPath The device path at which this Telegesis module exists.
143 OCStackResult TWInitialize(const char* deviceDevPath);
147 * Initiates necessary operations to find ZigBee devices.
150 OCStackResult TWDiscover();
154 * Gets a value at the specified parameters.
156 * @param[in] extendedUniqueId The extended unique id of the device.
157 * @param[in] nodeId The node id of the device.
158 * @param[in] endpointId The endpoint id from which the attribute belongs.
159 * @param[in] clusterId The cluster id from which the attribute belongs.
160 * @param[in] attributeId The attribute id from which the attribute belongs.
161 * @param[out] outValue The value at the specified attribute.
162 * @param[out] outValueLength The length of the value.
165 OCStackResult TWGetAttribute(char* extendedUniqueId, char* nodeId, char* endpointId,
166 char* clusterId, char* attributeId,
167 char** outValue, uint8_t* outValueLength);
171 * Sets a value at the specified parameters.
173 * @param[in] extendedUniqueId The extended unique id of the device.
174 * @param[in] nodeId The node id of the device.
175 * @param[in] endpointId The endpoint id from which the attribute belongs.
176 * @param[in] clusterId The cluster id from which the attribute belongs.
177 * @param[in] attributeId The attribute id from which the attribute belongs.
178 * @param[in] attributeType The attribute type of the attribute.
179 * @param[in] newValue The value to set at the specified attribute.
182 OCStackResult TWSetAttribute(char* extendedUniqueId, char* nodeId, char* endpointId,
183 char* clusterId, char* attributeId, char* attributeType,
188 * Switches a device to On/Off.
190 * @param[in] nodeId The node id of the device.
191 * @param[in] endpointId The endpoint id from which the attribute belongs.
192 * @param[in] newState Use "0" for OFF, "1" for ON, NULL for toggling.
195 OCStackResult TWSwitchOnOff(char* nodeId, char* endpointId, char* newState);
199 * Move to a level. All parameters are null-terminated.
201 * @param[in] nodeId The node id of the device.
202 * @param[in] endpointId The endpoint id from which the attribute belongs.
203 * @param[in] onOfState A boolean type number represents if the command
204 * is used with On/Off. If it is set to 0, it means the command is
205 * implemented as Move to Level command. If it is set to 1, it
206 * means the command will be implemented Move to Level
207 * (with On/Off) command.
209 * @param[in] level The The meaning of ‘level’ is device dependent
210 * e.g. for a light it may mean brightness level.
212 * @param[in] transTime The time taken to move to the new level
215 OCStackResult TWMoveToLevel(char* nodeId, char* endpointId,
216 char* onOffState, char* level, char* transTime);
220 * Switches door lock state.
222 * @param[in] nodeId The node id of the device.
223 * @param[in] endpointId The endpoint id from which the attribute belongs.
224 * @param[in] newState Use "0" to Unlock, "1" to Lock ON.
227 OCStackResult TWSwitchDoorLockState(char* nodeId, char* endpointId, char* newState);
231 * Sets discovery callback.
232 * This callback will be called when TWDiscover() discovers ZigBee device(s).
235 OCStackResult TWSetDiscoveryCallback(const TWDeviceFoundCallback callback);
239 * Sets status update callback.
240 * This callback will be called when there is an update on remote ZigBee devices.
243 OCStackResult TWSetStatusUpdateCallback(TWDeviceStatusUpdateCallback callback);
247 * Attempts to listen to status change updates of a remote zone device.
248 * A callback TWEnrollSucceedCallback will be invoked when this registration is fulfill.
249 * @param[in] nodeId The node id of the remote zone device.
250 * @param[in] endpointId The node id of the remote zone device.
254 OCStackResult TWListenForStatusUpdates(char* nodeId, char* endpointId);
258 * Uninitializes the Telegesis module.
261 OCStackResult TWUninitialize();
266 #endif // __cplusplus
268 #endif /* TELEGESISWRAPPER_H_ */