42 #include "aes/aescpp.h" 52 class ControllerReplication;
58 class ManufacturerSpecificDB;
93 ControllerInterface_Unknown = 0,
95 ControllerInterface_Hid
119 static void DriverThreadEntryPoint(
Event* _exitEvent,
void* _context );
138 void DriverThreadProc(
Event* _exitEvent );
152 bool Init(
uint32 _attempts );
158 void RemoveQueues(
uint8 const _nodeId );
166 bool m_awakeNodesQueried;
167 bool m_allNodesQueried;
168 bool m_notifytransactions;
175 void RequestConfig();
186 ControllerCaps_Secondary = 0x01,
187 ControllerCaps_OnOtherNetwork = 0x02,
188 ControllerCaps_SIS = 0x04,
189 ControllerCaps_RealPrimary = 0x08,
190 ControllerCaps_SUC = 0x10
196 InitCaps_Slave = 0x01,
197 InitCaps_TimerSupport = 0x02,
198 InitCaps_Secondary = 0x04,
202 bool IsPrimaryController()
const{
return ((m_initCaps & InitCaps_Secondary) == 0); }
203 bool IsStaticUpdateController()
const{
return ((m_initCaps & InitCaps_SUC) != 0); }
204 bool IsBridgeController()
const{
return (m_libraryType == 7); }
205 bool IsInclusionController()
const{
return ((m_controllerCaps & ControllerCaps_SIS) != 0); }
208 uint32 GetHomeId()
const{
return m_homeId; }
209 uint8 GetControllerNodeId()
const{
return m_Controller_nodeId; }
210 uint8 GetSUCNodeId()
const{
return m_SUCNodeId; }
211 uint16 GetManufacturerId()
const{
return m_manufacturerId; }
212 uint16 GetProductType()
const{
return m_productType; }
213 uint16 GetProductId()
const{
return m_productId; }
214 string GetControllerPath()
const{
return m_controllerPath; }
216 string GetLibraryVersion()
const{
return m_libraryVersion; }
217 string GetLibraryTypeName()
const{
return m_libraryTypeName; }
218 int32 GetSendQueueCount()
const 221 for(
int32 i=0; i<MsgQueue_Count; ++i )
223 count += (
int32) (m_msgQueue[i].size());
258 string m_controllerPath;
262 string m_libraryVersion;
263 string m_libraryTypeName;
266 uint8 m_serialAPIVersion[2];
274 uint8 m_controllerCaps;
275 uint8 m_Controller_nodeId;
281 uint8 m_transmitOptions;
288 void ProcessMsg(
uint8* _data );
290 void HandleGetVersionResponse(
uint8* _data );
291 void HandleGetRandomResponse(
uint8* _data );
292 void HandleGetControllerCapabilitiesResponse(
uint8* _data );
293 void HandleGetSerialAPICapabilitiesResponse(
uint8* _data );
294 void HandleSerialAPISoftResetResponse(
uint8* _data );
295 void HandleEnableSUCResponse(
uint8* _data );
296 void HandleSetSUCNodeIdResponse(
uint8* _data );
297 void HandleGetSUCNodeIdResponse(
uint8* _data );
298 void HandleMemoryGetIdResponse(
uint8* _data );
311 void HandleSerialAPIGetInitDataResponse(
uint8* _data );
312 void HandleGetNodeProtocolInfoResponse(
uint8* _data );
313 bool HandleRemoveFailedNodeResponse(
uint8* _data );
314 void HandleIsFailedNodeResponse(
uint8* _data );
315 bool HandleReplaceFailedNodeResponse(
uint8* _data );
316 bool HandleAssignReturnRouteResponse(
uint8* _data );
317 bool HandleDeleteReturnRouteResponse(
uint8* _data );
318 void HandleSendNodeInformationRequest(
uint8* _data );
319 void HandleSendDataResponse(
uint8* _data,
bool _replication );
320 bool HandleNetworkUpdateResponse(
uint8* _data );
321 void HandleGetRoutingInfoResponse(
uint8* _data );
323 void HandleSendDataRequest(
uint8* _data,
bool _replication );
324 void HandleAddNodeToNetworkRequest(
uint8* _data );
325 void HandleCreateNewPrimaryRequest(
uint8* _data );
326 void HandleControllerChangeRequest(
uint8* _data );
327 void HandleSetLearnModeRequest(
uint8* _data );
328 void HandleRemoveFailedNodeRequest(
uint8* _data );
329 void HandleReplaceFailedNodeRequest(
uint8* _data );
330 void HandleRemoveNodeFromNetworkRequest(
uint8* _data );
331 void HandleApplicationCommandHandlerRequest(
uint8* _data,
bool encrypted );
332 void HandlePromiscuousApplicationCommandHandlerRequest(
uint8* _data );
333 void HandleAssignReturnRouteRequest(
uint8* _data );
334 void HandleDeleteReturnRouteRequest(
uint8* _data );
335 void HandleNodeNeighborUpdateRequest(
uint8* _data );
336 void HandleNetworkUpdateRequest(
uint8* _data );
337 bool HandleApplicationUpdateRequest(
uint8* _data );
338 bool HandleRfPowerLevelSetResponse(
uint8* _data );
339 bool HandleSerialApiSetTimeoutsResponse(
uint8* _data );
340 bool HandleMemoryGetByteResponse(
uint8* _data );
341 bool HandleReadMemoryResponse(
uint8* _data );
342 void HandleGetVirtualNodesResponse(
uint8* _data );
343 bool HandleSetSlaveLearnModeResponse(
uint8* _data );
344 void HandleSetSlaveLearnModeRequest(
uint8* _data );
345 bool HandleSendSlaveNodeInfoResponse(
uint8* _data );
346 void HandleSendSlaveNodeInfoRequest(
uint8* _data );
347 void HandleApplicationSlaveCommandRequest(
uint8* _data );
348 void HandleSerialAPIResetRequest(
uint8* _data );
350 void CommonAddNodeStatusRequestHandler(
uint8 _funcId,
uint8* _data );
352 bool m_waitingForAck;
353 uint8 m_expectedCallbackId;
354 uint8 m_expectedReply;
355 uint8 m_expectedCommandClassId;
356 uint8 m_expectedNodeId;
362 int32 GetPollInterval(){
return m_pollInterval ; }
363 void SetPollInterval(
int32 _milliseconds,
bool _bIntervalBetweenPolls ){ m_pollInterval = _milliseconds; m_bIntervalBetweenPolls = _bIntervalBetweenPolls; }
364 bool EnablePoll(
const ValueID &_valueId,
uint8 _intensity = 1 );
365 bool DisablePoll(
const ValueID &_valueId );
366 bool isPolled(
const ValueID &_valueId );
367 void SetPollIntensity(
const ValueID &_valueId,
uint8 _intensity );
368 static void PollThreadEntryPoint(
Event* _exitEvent,
void* _context );
369 void PollThreadProc(
Event* _exitEvent );
378 list<PollEntry> m_pollList;
381 int32 m_pollInterval;
382 bool m_bIntervalBetweenPolls;
402 void InitNode(
uint8 const _nodeId,
bool newNode =
false,
bool secure =
false,
uint8 const *_protocolInfo =
NULL,
uint8 const _length = 0);
406 bool IsNodeListeningDevice(
uint8 const _nodeId );
407 bool IsNodeFrequentListeningDevice(
uint8 const _nodeId );
408 bool IsNodeBeamingDevice(
uint8 const _nodeId );
409 bool IsNodeRoutingDevice(
uint8 const _nodeId );
410 bool IsNodeSecurityDevice(
uint8 const _nodeId );
417 string GetNodeType(
uint8 const _nodeId );
420 string GetNodeManufacturerName(
uint8 const _nodeId );
421 string GetNodeProductName(
uint8 const _nodeId );
422 string GetNodeName(
uint8 const _nodeId );
423 string GetNodeLocation(
uint8 const _nodeId );
425 string GetNodeDeviceTypeString(
uint8 const _nodeId );
427 string GetNodeRoleString(
uint8 const _nodeId );
429 string GetNodePlusTypeString (
uint8 const _nodeId );
430 bool IsNodeZWavePlus(
uint8 const _nodeId );
433 uint16 GetNodeManufacturerId(
uint8 const _nodeId );
436 void SetNodeManufacturerName(
uint8 const _nodeId,
string const& _manufacturerName );
437 void SetNodeProductName(
uint8 const _nodeId,
string const& _productName );
438 void SetNodeName(
uint8 const _nodeId,
string const& _nodeName );
439 void SetNodeLocation(
uint8 const _nodeId,
string const& _location );
440 void SetNodeLevel(
uint8 const _nodeId,
uint8 const _level );
441 void SetNodeOn(
uint8 const _nodeId );
442 void SetNodeOff(
uint8 const _nodeId );
446 bool IsAPICallSupported(
uint8 const _apinum )
const{
return (( m_apiMask[( _apinum - 1 ) >> 3] & ( 1 << (( _apinum - 1 ) & 0x07 ))) != 0 ); }
447 void SetAPICall(
uint8 const _apinum,
bool _toSet )
451 m_apiMask[( _apinum - 1 ) >> 3] |= ( 1 << (( _apinum - 1 ) & 0x07 ));
455 m_apiMask[( _apinum - 1 ) >> 3] &= ~( 1 << (( _apinum - 1 ) & 0x07 ));
471 ControllerCommand_None = 0,
487 ControllerCommand_DeleteButton
497 ControllerState_Normal = 0,
507 ControllerState_NodeFailed
516 ControllerError_None = 0,
528 ControllerError_Overflow
535 void ResetController(
Event* _evt );
537 void RequestNodeNeighbors(
uint8 const _nodeId,
uint32 const _requestFlags );
539 bool BeginControllerCommand(
ControllerCommand _command, pfnControllerCallback_t _callback,
void* _context,
bool _highPower,
uint8 _nodeId,
uint8 _arg );
540 bool CancelControllerCommand();
541 void AddNodeStop(
uint8 const _funcId );
543 struct ControllerCommandItem
546 bool m_controllerStateChanged;
547 bool m_controllerCommandDone;
549 pfnControllerCallback_t m_controllerCallback;
551 void* m_controllerCallbackContext;
553 bool m_controllerAdded;
554 uint8 m_controllerCommandNode;
555 uint8 m_controllerCommandArg;
556 uint8 m_controllerDeviceProtocolInfo[254];
557 uint8 m_controllerDeviceProtocolInfoLength;
560 ControllerCommandItem* m_currentControllerCommand;
562 void DoControllerCommand();
567 void UpdateNodeRoutes(
uint8 const_nodeId,
bool _doUpdate =
false );
569 Event* m_controllerResetEvent;
577 MsgQueue_Command = 0,
612 bool WriteNextMsg(
MsgQueue const _queue );
613 bool WriteMsg(
string const &str);
614 void RemoveCurrentMsg();
615 bool MoveMessagesToWakeUpQueue(
uint8 const _targetNodeId,
bool const _move );
616 bool HandleErrorResponse(
uint8 const _error,
uint8 const _nodeId,
char const* _funcStr,
bool _sleepCheck =
false );
617 bool IsExpectedReply(
uint8 const _nodeId );
620 void CheckCompletedNodeQueries();
658 MsgQueueCmd_SendMsg = 0,
659 MsgQueueCmd_QueryStageComplete,
660 MsgQueueCmd_Controller,
661 MsgQueueCmd_ReloadNode
675 bool operator == ( MsgQueueItem
const& _other )
const 677 if( _other.m_command == m_command )
679 if( m_command == MsgQueueCmd_SendMsg )
681 return( (*_other.m_msg) == (*m_msg) );
683 else if( m_command == MsgQueueCmd_QueryStageComplete )
685 return( (_other.m_nodeId == m_nodeId) && (_other.m_queryStage == m_queryStage) );
687 else if( m_command == MsgQueueCmd_Controller )
689 return( (_other.m_cci->m_controllerCommand == m_cci->m_controllerCommand) && (_other.m_cci->m_controllerCallback == m_cci->m_controllerCallback) );
691 else if (m_command == MsgQueueCmd_ReloadNode )
693 return (_other.m_nodeId == m_nodeId);
701 MsgQueueCmd m_command;
706 ControllerCommandItem* m_cci;
710 list<MsgQueueItem> m_msgQueue[MsgQueue_Count];
712 Event* m_queueEvent[MsgQueue_Count];
722 void TestNetwork(
uint8 const _nodeId,
uint32 const _count );
734 void RequestVirtualNeighbors(
MsgQueue const _queue );
735 bool IsVirtualNode(
uint8 const _nodeId )
const{
return (( m_virtualNeighbors[( _nodeId - 1 ) >> 3] & 1 << (( _nodeId - 1 ) & 0x07 )) != 0 ); }
736 void SendVirtualNodeInfo(
uint8 const _fromNodeId,
uint8 const _ToNodeId );
737 void SendSlaveLearnModeOff();
739 void ReadButtons(
uint8 const _nodeId );
741 bool m_virtualNeighborsReceived;
757 bool SetConfigParam(
uint8 const _nodeId,
uint8 const _param,
int32 _value,
uint8 const _size );
758 void RequestConfigParam(
uint8 const _nodeId,
uint8 const _param );
768 uint8 GetMaxAssociations(
uint8 const _nodeId,
uint8 const _groupIdx );
769 string GetGroupLabel(
uint8 const _nodeId,
uint8 const _groupIdx );
770 void AddAssociation(
uint8 const _nodeId,
uint8 const _groupIdx,
uint8 const _targetNodeId,
uint8 const _instance = 0x00 );
771 void RemoveAssociation(
uint8 const _nodeId,
uint8 const _groupIdx,
uint8 const _targetNodeId,
uint8 const _instance = 0x00 );
778 void NotifyWatchers();
781 list<Notification*> m_notifications;
783 Event* m_notificationsEvent;
814 void LogDriverStatistics();
817 void GetDriverStatistics(
DriverData* _data );
839 uint32 m_broadcastReadCnt;
840 uint32 m_broadcastWriteCnt;
849 aes_encrypt_ctx *GetAuthKey();
850 aes_encrypt_ctx *GetEncKey();
851 bool isNetworkKeySet();
854 bool initNetworkKeys(
bool newnode);
855 uint8 *GetNetworkKey();
856 bool SendEncryptedMessage();
857 bool SendNonceRequest(
string logmsg);
858 void SendNonceKey(
uint8 nodeId,
uint8 *nonce);
859 aes_encrypt_ctx *AuthKey;
860 aes_encrypt_ctx *EncryptKey;
861 uint8 m_nonceReportSent;
862 uint8 m_nonceReportSentAttempt;
863 bool m_inclusionkeySet;
881 void SubmitEventMsg(EventMsg *);
882 void ProcessEventMsg();
886 list<EventMsg *> m_eventQueueMsg;
888 Event* m_queueMsgEvent;
897 bool CheckNodeConfigRevision(
Node *);
898 bool CheckMFSConfigRevision();
899 void ReloadNode(
uint8 const _nodeId);
911 bool startConfigDownload(
uint16 _manufacturerId,
uint16 _productType,
uint16 _productId,
string configfile,
uint8 node = 0);
912 bool startMFSDownload(
string configfile);
913 bool refreshNodeConfig(
uint8 node);
930 bool downloadConfigRevision(
Node *);
931 bool downloadMFSRevision();
Implements COMMAND_CLASS_NO_OPERATION (0x00), a Z-Wave device command class.
Definition: NoOperation.h:38
uint32 m_CANCnt
Definition: Driver.h:797
Implements COMMAND_CLASS_ASSOCIATION (0x85), a Z-Wave device command class.
Definition: Association.h:39
Message object to be passed to and from devices on the Z-Wave network.
Definition: Msg.h:44
Definition: Bitfield.h:34
Container that holds all of the values associated with a given node.
Definition: ValueStore.h:44
Definition: DNSThread.h:54
MsgQueue
Definition: Driver.h:575
Implements COMMAND_CLASS_SECURITY (0x98), a Z-Wave device command class.
Definition: Security.h:64
uint8 GetTargetNodeId() const
Identifies the Node ID of the "target" node (if any) for this function.
Definition: Msg.h:67
#define OPENZWAVE_EXPORT
Definition: Defs.h:52
Implements COMMAND_CLASS_MANUFACTURER_SPECIFIC (0x72), a Z-Wave device command class.
Definition: ManufacturerSpecific.h:39
unsigned short uint16
Definition: Defs.h:93
#define OPENZWAVE_EXPORT_WARNINGS_ON
Definition: Defs.h:54
the DNSThread provides Async DNS lookups for checking revision numbers of Config Files against the of...
Definition: DNSThread.h:67
uint32 m_routedbusy
Definition: Driver.h:809
Represents a USB ControllerController is derived from Stream rather than containing one...
Definition: Controller.h:55
Platform-independent definition of event objects.
Definition: Event.h:40
The _ManufacturerSpecificDB class handles the Config File Database that we use to configure devices...
Definition: ManufacturerSpecificDB.h:106
uint32 m_nondelivery
Definition: Driver.h:808
uint8 GetTransmitOptions() const
Definition: Driver.h:592
uint32 m_readAborts
Definition: Driver.h:793
Implements COMMAND_CLASS_WAKE_UP (0x84), a Z-Wave device command class.
Definition: WakeUp.h:44
The main public interface to OpenZWave.
Definition: Manager.h:110
MetaDataFields
Definition: Node.h:697
uint32 m_ACKWaiting
Definition: Driver.h:792
Implements a platform-independent thread management class.
Definition: Thread.h:43
QueryStage
Definition: Node.h:136
uint32 m_badChecksum
Definition: Driver.h:794
uint32 m_writeCnt
Definition: Driver.h:796
#define OPENZWAVE_EXPORT_WARNINGS_OFF
Definition: Defs.h:53
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition: Node.h:65
#define NULL
Definition: Defs.h:86
ControllerCommand
Definition: Driver.h:469
uint32 m_readCnt
Definition: Driver.h:795
Base class for all Z-Wave command classes.
Definition: CommandClass.h:54
ControllerError
Definition: Driver.h:514
uint32 m_OOFCnt
Definition: Driver.h:800
ControllerState
Definition: Driver.h:495
uint32 m_notidle
Definition: Driver.h:807
uint32 m_SOFCnt
Definition: Driver.h:791
Implements COMMAND_CLASS_MULTI_CHANNEL_ASSOCIATION (0x8E), a Z-Wave device command class...
Definition: MultiChannelAssociation.h:40
ControllerInterface
Definition: Driver.h:91
uint32 m_broadcastReadCnt
Definition: Driver.h:810
The Driver class handles communication between OpenZWave and a device attached via a serial port (typ...
Definition: Driver.h:63
Implements COMMAND_CLASS_SCENEACTIVATION (0x2B), a Z-Wave device command class.
Definition: SceneActivation.h:40
uint32 m_badroutes
Definition: Driver.h:804
signed int int32
Definition: Defs.h:95
unsigned int uint32
Definition: Defs.h:96
uint8 GetNodeNumber(Msg const *_msg) const
Definition: Driver.h:388
Manages a group of devices (various nodes associated with each other).
Definition: Group.h:49
Provides a container for data sent via the notification callback handler installed by a call to Manag...
Definition: Notification.h:44
uint32 m_broadcastWriteCnt
Definition: Driver.h:811
Provides a unique ID for a value reported by a Z-Wave device.The ValueID is used to uniquely identify...
Definition: ValueID.h:62
uint32 m_callbacks
Definition: Driver.h:803
uint32 m_netbusy
Definition: Driver.h:806
Implements a platform-independent mutex–for serializing access to a shared resource.
Definition: Mutex.h:40
uint32 m_retries
Definition: Driver.h:802
uint32 m_noack
Definition: Driver.h:805
Implements a platform-independent TimeStamp.
Definition: TimeStamp.h:40
Base class for values associated with a node.
Definition: Value.h:48
uint32 m_dropped
Definition: Driver.h:801
uint32 m_NAKCnt
Definition: Driver.h:798
Implements COMMAND_CLASS_NODE_NAMING (0x77), a Z-Wave device command class.
Definition: NodeNaming.h:54
Implements COMMAND_CLASS_CONTROLLER_REPLICATION (0x21), a Z-Wave device command class.
Definition: ControllerReplication.h:38
uint32 m_ACKCnt
Definition: Driver.h:799
Implements COMMAND_CLASS_BASIC (0x20), a Z-Wave device command class.
Definition: Basic.h:40
#define NUM_NODE_BITFIELD_BYTES
Definition: Defs.h:238
unsigned char uint8
Definition: Defs.h:90