Skip to content

Commit

Permalink
some spring-time refactoring...
Browse files Browse the repository at this point in the history
  • Loading branch information
ekarak committed Mar 16, 2013
1 parent bba4bd3 commit 6861313
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 468 deletions.
8 changes: 8 additions & 0 deletions INSTALL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(this will worl on Debian 6, you have to adjust according to your distro)

sudo apt-get install ruby1.9.1-dev gccxml libxml2-dev libxslt-dev
sudo apt-get install libboost1.42-dev libboost_system1.42-dev libboost_thread1.42-dev lib libboost-filesystem1.42-dev libboost-program-options1.42-dev

sudo gem1.9.1 install mongrel --pre
sudo gem1.9.1 install rspec
sudo gem1.9.1 install rbgccxml
16 changes: 10 additions & 6 deletions Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ for more information on the LGPL, see:
//

#include "RemoteManager.h"
#include <protocol/TBinaryProtocol.h>
#include <protocol/TJSONProtocol.h>
#include <server/TSimpleServer.h>
#include <transport/TServerSocket.h>
#include <transport/TBufferTransports.h>
Expand All @@ -44,6 +44,9 @@ for more information on the LGPL, see:
// alse we're using boost's filesystem classes
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/exception/info.hpp>

typedef boost::error_info<struct tag_stack_str,std::string> stack_info;

namespace po = boost::program_options;
namespace fs = boost::filesystem;
Expand Down Expand Up @@ -85,7 +88,7 @@ static bool g_initFailed = false;
static boost::condition_variable initCond ;
static boost::mutex initMutex;

// Stromp client
// Stomp client
#include "BoostStomp.hpp"
static STOMP::BoostStomp* stomp_client;
static string* notifications_topic = new string("/queue/zwave/monitor");
Expand Down Expand Up @@ -416,7 +419,6 @@ int main(int argc, char *argv[]) {

// Add a Z-Wave Driver
Manager::Get()->AddDriver( ozw_port );
//Manager::Get()->AddDriver( "HID Controller", Driver::ControllerInterface_Hid );
}
catch (exception& e)
{
Expand All @@ -429,8 +431,6 @@ int main(int argc, char *argv[]) {
shared_ptr<RemoteManagerHandler> handler(new RemoteManagerHandler());
shared_ptr<TProcessor> processor(new RemoteManagerProcessor(handler));
TServerSocket* ss = new TServerSocket(thrift_port);
// set 3 seconds timeout value
ss->setRecvTimeout(3000);
shared_ptr<TServerTransport> serverTransport(ss);
shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
Expand All @@ -448,7 +448,11 @@ int main(int argc, char *argv[]) {
}
catch (exception& e)
{
cerr << "Exception in OpenZWave Thrift server: " << e.what() << "\n";
if ( std::string const *stack = boost::get_error_info<stack_info>(e) ) {
cerr << stack << endl;
} else {
cerr << "Exception in OpenZWave Thrift server: " << e.what() << "\n";
}
return 5;
}

Expand Down
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

.SUFFIXES: .cpp .o .a .s .thrift

CC := gcc
CXX := g++
#CC := gcc
#CXX := g++
CC := clang
CXX := clang++
LD := ld
AR := ar rc
RANLIB := ranlib
Expand Down Expand Up @@ -103,7 +105,7 @@ ozwd.static: Main.o booststomp gen-cpp/RemoteManager.o gen-cpp/ozw_constants.o g

ozwd: Main.o booststomp gen-cpp/RemoteManager.o gen-cpp/ozw_constants.o gen-cpp/ozw_types.o $(LIBZWAVE_DYNAMIC)
$(CXX) -o $@ $(LDFLAGS) Main.o gen-cpp/RemoteManager.o gen-cpp/ozw_constants.o gen-cpp/ozw_types.o $(LIBZWAVE_DYNAMIC) $(LIBS)

dist: main
rm -f Thrift4OZW.tar.gz
tar -c --exclude=".git" --exclude ".svn" --exclude "*.o" -hvzf Thrift4OZW.tar.gz *.cpp *.h *.thrift *.sm *.rb Makefile gen-*/ license/ README*
Expand All @@ -122,5 +124,5 @@ binclean:
thrift: gen-cpp/RemoteManager.cpp

patchdiffs:
- diff -C3 gen-cpp/ozw_types.h.orig gen-cpp/ozw_types.h.patched > ozw_types.h.patch
- diff -C3 gen-cpp/RemoteManager_server.cpp.orig gen-cpp/RemoteManager_server.cpp.patched > RemoteManager_server.cpp.patch
- diff -C3 gen-cpp/ozw_types.h.orig gen-cpp/ozw_types.h > ozw_types.h.patch
- diff -C3 gen-cpp/RemoteManager_server.cpp.orig gen-cpp/RemoteManager_server.cpp > RemoteManager_server.cpp.patch
3 changes: 3 additions & 0 deletions gen-csharp/OpenZWave/DriverControllerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

namespace OpenZWave
{
/// <summary>
/// < A collection of bytes
/// </summary>
public enum DriverControllerCommand
{
ControllerCommand_None = 0,
Expand Down
1 change: 1 addition & 0 deletions gen-csharp/OpenZWave/RemoteValueType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ public enum RemoteValueType
ValueType_Short = 6,
ValueType_String = 7,
ValueType_Button = 8,
ValueType_Raw = 9,
}
}
1 change: 1 addition & 0 deletions gen-erl/ozw_types.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
-define(ozw_RemoteValueType_ValueType_Short, 6).
-define(ozw_RemoteValueType_ValueType_String, 7).
-define(ozw_RemoteValueType_ValueType_Button, 8).
-define(ozw_RemoteValueType_ValueType_Raw, 9).

-define(ozw_DriverControllerCommand_ControllerCommand_None, 0).
-define(ozw_DriverControllerCommand_ControllerCommand_AddDevice, 1).
Expand Down
6 changes: 6 additions & 0 deletions gen-go/OpenZWave/ttypes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions gen-java/OpenZWave/DriverControllerCommand.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion gen-java/OpenZWave/RemoteValueType.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion gen-js/ozw_types.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gen-perl/OpenZWave/Types.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use constant ValueType_Schedule => 5;
use constant ValueType_Short => 6;
use constant ValueType_String => 7;
use constant ValueType_Button => 8;
use constant ValueType_Raw => 9;
package OpenZWave::DriverControllerCommand;
use constant ControllerCommand_None => 0;
use constant ControllerCommand_AddDevice => 1;
Expand Down
6 changes: 6 additions & 0 deletions gen-py/OpenZWave/ttypes.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions gen-rb/ozw_types.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ozw.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ enum RemoteValueType
ValueType_Schedule=5,
ValueType_Short=6,
ValueType_String=7,
ValueType_Button=8
ValueType_Button=8,
ValueType_Raw /**< A collection of bytes */
}

enum DriverControllerCommand
Expand Down
Loading

0 comments on commit 6861313

Please sign in to comment.