Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 803e3a95f9
Fetching contributors…

Cannot retrieve contributors at this time

233 lines (196 sloc) 7.926 kb
*** gen-cpp/RemoteManager_server.cpp.orig 2012-04-16 12:30:14.455818161 +0300
--- gen-cpp/RemoteManager_server.cpp.patched 2012-03-27 20:25:01.384749101 +0300
***************
*** 1,11 ****
// Automatically generated OpenZWave::Manager_server wrapper
! // (c) 2011 Elias Karakoulakis <elias.karakoulakis@gmail.com>
#include "RemoteManager.h"
! #include <thrift/protocol/TBinaryProtocol.h>
! #include <thrift/server/TSimpleServer.h>
! #include <thrift/transport/TServerSocket.h>
! #include <thrift/transport/TBufferTransports.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
--- 1,11 ----
// Automatically generated OpenZWave::Manager_server wrapper
! // (c) 2011-2012 Elias Karakoulakis <elias.karakoulakis@gmail.com>
#include "RemoteManager.h"
! #include <protocol/TBinaryProtocol.h>
! #include <server/TSimpleServer.h>
! #include <transport/TServerSocket.h>
! #include <transport/TBufferTransports.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
***************
*** 17,23 ****
using namespace ::OpenZWave;
void BeginControllerCommand_callback(OpenZWave::Driver::ControllerState arg1, void* arg2) {
! // FIXME: fill in the blanks (sorry!)
}
class RemoteManagerHandler : virtual public RemoteManagerIf {
--- 17,30 ----
using namespace ::OpenZWave;
void BeginControllerCommand_callback(OpenZWave::Driver::ControllerState arg1, void* arg2) {
! g_criticalSection.lock();
! //
! STOMP::hdrmap headers;
! headers["ControllerState"] = to_string<uint16_t>(arg1, std::hex);
! string empty = "" ;
! stomp_client->send(*notifications_topic, headers, empty);
! //
! g_criticalSection.unlock();
}
class RemoteManagerHandler : virtual public RemoteManagerIf {
***************
*** 260,269 ****
}
void GetNodeNeighbors(UInt32_ListByte& _return, const int32_t _homeId, const int8_t _nodeId) {
Manager* mgr = Manager::Get();
g_criticalSection.lock();
! _return.retval = mgr->GetNodeNeighbors((::uint32 const) _homeId, (::uint8 const) _nodeId, (::uint8**) &_return._nodeNeighbors);
g_criticalSection.unlock();
}
void GetNodeManufacturerName(std::string& _return, const int32_t _homeId, const int8_t _nodeId) {
--- 267,281 ----
}
void GetNodeNeighbors(UInt32_ListByte& _return, const int32_t _homeId, const int8_t _nodeId) {
+ uint8* arr;
Manager* mgr = Manager::Get();
g_criticalSection.lock();
! _return.retval = mgr->GetNodeNeighbors((::uint32 const) _homeId, (::uint8 const) _nodeId, (::uint8**) &arr);
g_criticalSection.unlock();
+ if (_return.retval > 0) {
+ for (int i=0; i<_return.retval; i++) _return._nodeNeighbors.push_back(arr[i]);
+ delete arr;
+ }
}
void GetNodeManufacturerName(std::string& _return, const int32_t _homeId, const int8_t _nodeId) {
***************
*** 525,535 ****
g_criticalSection.unlock();
}
! void GetValueListItems(Bool_ListString& _return, const RemoteValueID& _id) {
Manager* mgr = Manager::Get();
g_criticalSection.lock();
! _return.retval = mgr->GetValueListItems(_id.toValueID(), (std::vector<std::string, std::allocator<std::string> >*) &_return.o_value);
g_criticalSection.unlock();
}
void GetValueFloatPrecision(Bool_UInt8& _return, const RemoteValueID& _id) {
--- 537,551 ----
g_criticalSection.unlock();
}
! void GetValueListItems(Bool_ListString& _return, const RemoteValueID& _id) {
! std::vector<std::string> o_values;
Manager* mgr = Manager::Get();
g_criticalSection.lock();
! _return.retval = mgr->GetValueListItems(_id.toValueID(), &o_values);
g_criticalSection.unlock();
+ if (_return.retval > 0) {
+ for (int i=0; i< _return.retval; i++) _return.o_value.push_back(std::string(o_values[i]));
+ }
}
void GetValueFloatPrecision(Bool_UInt8& _return, const RemoteValueID& _id) {
***************
*** 604,613 ****
}
void SetChangeVerified(const RemoteValueID& _id, const bool _verify) {
! Manager* mgr = Manager::Get();
! g_criticalSection.lock();
! mgr->SetChangeVerified(_id.toValueID(), (bool) _verify);
! g_criticalSection.unlock();
}
bool PressButton(const RemoteValueID& _id) {
--- 620,629 ----
}
void SetChangeVerified(const RemoteValueID& _id, const bool _verify) {
! Manager* mgr = Manager::Get();
! g_criticalSection.lock();
! mgr->SetChangeVerified(_id.toValueID(), (bool) _verify);
! g_criticalSection.unlock();
}
bool PressButton(const RemoteValueID& _id) {
***************
*** 709,718 ****
}
void GetAssociations(GetAssociationsReturnStruct& _return, const int32_t _homeId, const int8_t _nodeId, const int8_t _groupIdx) {
Manager* mgr = Manager::Get();
g_criticalSection.lock();
! _return.retval = mgr->GetAssociations((::uint32 const) _homeId, (::uint8 const) _nodeId, (::uint8 const) _groupIdx, (::uint8**) &_return.o_associations);
g_criticalSection.unlock();
}
int8_t GetMaxAssociations(const int32_t _homeId, const int8_t _nodeId, const int8_t _groupIdx) {
--- 725,739 ----
}
void GetAssociations(GetAssociationsReturnStruct& _return, const int32_t _homeId, const int8_t _nodeId, const int8_t _groupIdx) {
+ uint8* o_associations;
Manager* mgr = Manager::Get();
g_criticalSection.lock();
! _return.retval = mgr->GetAssociations((::uint32 const) _homeId, (::uint8 const) _nodeId, (::uint8 const) _groupIdx, (::uint8**) &o_associations);
g_criticalSection.unlock();
+ if (_return.retval > 0) {
+ for (int i=0; i<_return.retval; i++) _return.o_associations.push_back(o_associations[i]);
+ delete o_associations;
+ }
}
int8_t GetMaxAssociations(const int32_t _homeId, const int8_t _nodeId, const int8_t _groupIdx) {
***************
*** 783,792 ****
}
void GetAllScenes(GetAllScenesReturnStruct& _return) {
Manager* mgr = Manager::Get();
g_criticalSection.lock();
! _return.retval = mgr->GetAllScenes((::uint8**) &_return._sceneIds);
g_criticalSection.unlock();
}
int8_t CreateScene() {
--- 804,818 ----
}
void GetAllScenes(GetAllScenesReturnStruct& _return) {
+ uint8* _sceneIds;
Manager* mgr = Manager::Get();
g_criticalSection.lock();
! _return.retval = mgr->GetAllScenes((::uint8**) &_sceneIds);
g_criticalSection.unlock();
+ if (_return.retval>0) {
+ for (int i=0; i<_return.retval; i++) _return._sceneIds.push_back(_sceneIds[i]);
+ delete(_sceneIds);
+ }
}
int8_t CreateScene() {
***************
*** 878,887 ****
}
void SceneGetValues(SceneGetValuesReturnStruct& _return, const int8_t _sceneId) {
Manager* mgr = Manager::Get();
g_criticalSection.lock();
! _return.retval = mgr->SceneGetValues((::uint8 const) _sceneId, _return.o_value.toValueID());
g_criticalSection.unlock();
}
void SceneGetValueAsBool(Bool_Bool& _return, const int8_t _sceneId, const RemoteValueID& _valueId) {
--- 904,915 ----
}
void SceneGetValues(SceneGetValuesReturnStruct& _return, const int8_t _sceneId) {
+ std::vector<OpenZWave::ValueID> o_values;
Manager* mgr = Manager::Get();
g_criticalSection.lock();
! _return.retval = mgr->SceneGetValues((::uint8 const) _sceneId, &o_values);
g_criticalSection.unlock();
+ for (int i=0; i< _return.retval; i++) _return.o_value.push_back(RemoteValueID(o_values[i]));
}
void SceneGetValueAsBool(Bool_Bool& _return, const int8_t _sceneId, const RemoteValueID& _valueId) {
***************
*** 1042,1049 ****
}
void SendAllValues() {
! // Your implementation goes here
! printf("SendAllValues\n");
}
};
--- 1070,1078 ----
}
void SendAllValues() {
! g_criticalSection.lock();
! send_all_values();
! g_criticalSection.unlock();
}
};
Jump to Line
Something went wrong with that request. Please try again.