From c2ac86e7f841d60fba199cc9a7d9adac44cd79e1 Mon Sep 17 00:00:00 2001 From: Thomas Kintscher Date: Fri, 18 Jan 2019 01:48:47 +0000 Subject: [PATCH 1/2] Expose functionality for sending raw data on the network. --- src-lib/libopenzwave/libopenzwave.pyx | 20 ++++++++++++++++++++ src-lib/libopenzwave/manager.pxd | 1 + 2 files changed, 21 insertions(+) diff --git a/src-lib/libopenzwave/libopenzwave.pyx b/src-lib/libopenzwave/libopenzwave.pyx index 2753a7d5..1e23420a 100644 --- a/src-lib/libopenzwave/libopenzwave.pyx +++ b/src-lib/libopenzwave/libopenzwave.pyx @@ -4950,3 +4950,23 @@ sceneGetValues_ ''' return self.manager.ActivateScene(sceneid) + + def sendRawData(self, homeId, nodeId, logText, msgType, content): + ''' +.. _sendRawData: + +Send a custom message to a node. + +:param homeId: The ID of the network. +:type homeId: int +:param nodeId: The ID of the target node. +:type nodeId: int +:param logText: The text to prefix the resulting log message. +:type logText: str +:param msgType: The type of the message. +:type msgType: int +:param content: The message content. +:type content: bytes + ''' + return self.manager.SendRawData(homeId, nodeId, logText, msgType, content, len(content)) + diff --git a/src-lib/libopenzwave/manager.pxd b/src-lib/libopenzwave/manager.pxd index 93f7203f..9fed9c58 100644 --- a/src-lib/libopenzwave/manager.pxd +++ b/src-lib/libopenzwave/manager.pxd @@ -246,6 +246,7 @@ cdef extern from "Manager.h" namespace "OpenZWave": void SetSceneLabel( uint8_t sceneId, string value ) bool SceneExists( uint8_t sceneId ) bool ActivateScene( uint8_t sceneId ) + void SendRawData( uint32_t _homeId, uint8_t _nodeId, string _logText, uint8_t _msgType, uint8_t* _content, uint8_t _length ) cdef extern from "Manager.h" namespace "OpenZWave::Manager": Manager* Create() From 1a8ee4670f22b69ec9ed1616b091c6c1be688395 Mon Sep 17 00:00:00 2001 From: Thomas Kintscher Date: Sun, 27 Jan 2019 17:05:37 +0100 Subject: [PATCH 2/2] Expose option to encrypt custom messages. --- src-lib/libopenzwave/libopenzwave.pyx | 6 ++++-- src-lib/libopenzwave/manager.pxd | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src-lib/libopenzwave/libopenzwave.pyx b/src-lib/libopenzwave/libopenzwave.pyx index 1e23420a..487646d7 100644 --- a/src-lib/libopenzwave/libopenzwave.pyx +++ b/src-lib/libopenzwave/libopenzwave.pyx @@ -4951,7 +4951,7 @@ sceneGetValues_ ''' return self.manager.ActivateScene(sceneid) - def sendRawData(self, homeId, nodeId, logText, msgType, content): + def sendRawData(self, homeId, nodeId, logText, msgType, sendSecure, content): ''' .. _sendRawData: @@ -4965,8 +4965,10 @@ Send a custom message to a node. :type logText: str :param msgType: The type of the message. :type msgType: int +:param sendSecure: Indicates whether the packet should be encrypted (if the CC accepts it). +:type sendSecure: bool :param content: The message content. :type content: bytes ''' - return self.manager.SendRawData(homeId, nodeId, logText, msgType, content, len(content)) + return self.manager.SendRawData(homeId, nodeId, logText, msgType, sendSecure, content, len(content)) diff --git a/src-lib/libopenzwave/manager.pxd b/src-lib/libopenzwave/manager.pxd index 9fed9c58..7634fe0a 100644 --- a/src-lib/libopenzwave/manager.pxd +++ b/src-lib/libopenzwave/manager.pxd @@ -246,7 +246,7 @@ cdef extern from "Manager.h" namespace "OpenZWave": void SetSceneLabel( uint8_t sceneId, string value ) bool SceneExists( uint8_t sceneId ) bool ActivateScene( uint8_t sceneId ) - void SendRawData( uint32_t _homeId, uint8_t _nodeId, string _logText, uint8_t _msgType, uint8_t* _content, uint8_t _length ) + void SendRawData( uint32_t _homeId, uint8_t _nodeId, string _logText, uint8_t _msgType, bool _sendSecure, uint8_t* _content, uint8_t _length ) cdef extern from "Manager.h" namespace "OpenZWave::Manager": Manager* Create()