Permalink
Browse files

updated demo files

  • Loading branch information...
1 parent b3a4c17 commit cdcf18725449f927fe785f72e79913836466866c @ekarak ekarak committed Mar 17, 2012
Showing with 4,272 additions and 15,013 deletions.
  1. +6 −6 Main.cpp
  2. +37 −12 README-OpenZWave.txt
  3. +1 −1 create_server.rb
  4. +30 −149 gen-cocoa/ozw.h
  5. +1,687 −4,916 gen-cocoa/ozw.m
  6. +29 −779 gen-cpp/RemoteManager.cpp
  7. +8 −9 gen-cpp/RemoteManager.h
  8. +1 −1 gen-cpp/RemoteManager_server.cpp.patch
  9. +1 −1 gen-cpp/ozw_constants.cpp
  10. +1 −1 gen-cpp/ozw_constants.h
  11. +1 −201 gen-cpp/ozw_types.cpp
  12. +240 −2 gen-cpp/ozw_types.h.patch
  13. +1 −7 gen-csharp/OpenZWave/Bool_Bool.cs
  14. +1 −7 gen-csharp/OpenZWave/Bool_Float.cs
  15. +1 −7 gen-csharp/OpenZWave/Bool_GetNodeClassInformation.cs
  16. +1 −7 gen-csharp/OpenZWave/Bool_Int.cs
  17. +1 −7 gen-csharp/OpenZWave/Bool_Int16.cs
  18. +1 −7 gen-csharp/OpenZWave/Bool_ListString.cs
  19. +1 −7 gen-csharp/OpenZWave/Bool_String.cs
  20. +1 −7 gen-csharp/OpenZWave/Bool_UInt8.cs
  21. +1 −49 gen-csharp/OpenZWave/DriverControllerCommand.cs
  22. +1 −7 gen-csharp/OpenZWave/DriverData.cs
  23. +1 −7 gen-csharp/OpenZWave/GetAllScenesReturnStruct.cs
  24. +1 −7 gen-csharp/OpenZWave/GetAssociationsReturnStruct.cs
  25. +1 −7 gen-csharp/OpenZWave/GetDriverStatisticsReturnStruct.cs
  26. +1 −7 gen-csharp/OpenZWave/GetSwitchPointReturnStruct.cs
  27. +142 −5,645 gen-csharp/OpenZWave/RemoteManager.cs
  28. +1 −1 gen-csharp/OpenZWave/RemoteValueGenre.cs
  29. +1 −18 gen-csharp/OpenZWave/RemoteValueID.cs
  30. +1 −1 gen-csharp/OpenZWave/RemoteValueType.cs
  31. +1 −7 gen-csharp/OpenZWave/SceneGetValuesReturnStruct.cs
  32. +1 −7 gen-csharp/OpenZWave/UInt32_ListByte.cs
  33. +1 −1 gen-erl/ozw_constants.hrl
  34. +1 −1 gen-erl/ozw_types.erl
  35. +1 −1 gen-erl/remoteManager_thrift.erl
  36. +1 −1 gen-go/OpenZWave/RemoteManager.go
  37. +1 −1 gen-go/OpenZWave/RemoteManager/RemoteManager-remote.go
  38. +1 −1 gen-go/OpenZWave/ttypes.go
  39. +11 −12 gen-java/OpenZWave/Bool_Bool.java
  40. +11 −12 gen-java/OpenZWave/Bool_Float.java
  41. +11 −12 gen-java/OpenZWave/Bool_GetNodeClassInformation.java
  42. +11 −12 gen-java/OpenZWave/Bool_Int.java
  43. +11 −12 gen-java/OpenZWave/Bool_Int16.java
  44. +8 −9 gen-java/OpenZWave/Bool_ListString.java
  45. +8 −9 gen-java/OpenZWave/Bool_String.java
  46. +11 −12 gen-java/OpenZWave/Bool_UInt8.java
  47. +1 −1 gen-java/OpenZWave/DriverControllerCommand.java
  48. +47 −48 gen-java/OpenZWave/DriverData.java
  49. +8 −9 gen-java/OpenZWave/GetAllScenesReturnStruct.java
  50. +8 −9 gen-java/OpenZWave/GetAssociationsReturnStruct.java
  51. +1 −6 gen-java/OpenZWave/GetDriverStatisticsReturnStruct.java
  52. +17 −18 gen-java/OpenZWave/GetSwitchPointReturnStruct.java
  53. +1,734 −2,649 gen-java/OpenZWave/RemoteManager.java
  54. +1 −1 gen-java/OpenZWave/RemoteValueGenre.java
  55. +20 −21 gen-java/OpenZWave/RemoteValueID.java
  56. +1 −1 gen-java/OpenZWave/RemoteValueType.java
  57. +8 −9 gen-java/OpenZWave/SceneGetValuesReturnStruct.java
  58. +8 −9 gen-java/OpenZWave/UInt32_ListByte.java
  59. +1 −1 gen-js/RemoteManager.js
  60. +1 −1 gen-js/ozw_types.js
  61. +1 −1 gen-perl/OpenZWave/Constants.pm
  62. +1 −1 gen-perl/OpenZWave/RemoteManager.pm
  63. +1 −1 gen-perl/OpenZWave/Types.pm
  64. +1 −1 gen-php/ozw/RemoteManager.php
  65. +4 −4 gen-php/ozw/ozw_types.php
  66. +1 −1 gen-py/OpenZWave/RemoteManager-remote
  67. +1 −1 gen-py/OpenZWave/RemoteManager.py
  68. +1 −1 gen-py/OpenZWave/constants.py
  69. +1 −1 gen-py/OpenZWave/ttypes.py
  70. +1 −1 gen-rb/ozw_constants.rb
  71. +7 −7 gen-rb/ozw_types.rb
  72. +94 −94 gen-rb/remote_manager.rb
  73. +0 −116 monitor.rb
  74. +2 −3 ozw-headers.rb
  75. BIN ozwd
  76. +9 −4 ozwthrift.rb
View
@@ -182,6 +182,8 @@ void OnNotification
/**< The associations for the node have changed. The application
should rebuild any group information it holds about the node. */
}
+ break;
+
case Notification::Type_Group:
/**< A new node has been found (not already stored in zwcfg*.xml file) */
case Notification::Type_NodeNew:
@@ -192,17 +194,16 @@ void OnNotification
case Notification::Type_NodeProtocolInfo:
/**< A node has triggered an event. This is commonly caused when a node sends
a Basic_Set command to the controller. The event value is stored in the notification. */
- case Notification::Type_NodeEvent:
+/* case Notification::Type_NodeEvent:
{
if( NodeInfo* nodeInfo = GetNodeInfo( _notification ) )
{
// One of the node's association groups has changed
// TBD...
- nodeInfo = nodeInfo;
}
break;
}
-
+*/
/**< A new node has been added to OpenZWave's list. This may be due
to a device being added to the Z-Wave network, or because
@@ -291,8 +292,7 @@ void OnNotification
}
default:
- {
- }
+ break;
}
// now we can send the captured event to STOMP queue
@@ -451,4 +451,4 @@ int main(int argc, char *argv[]) {
}
return 0;
-}
+}
View
@@ -18,13 +18,19 @@ My folder hierarchy is:
- Skip to next section if you're running Linux x86/32-bit and just want to try talking
to the OpenZWave library (a precompiled binary is included)
+
- Take a look at ozw.thrift, it's the Thrift interface definition file. All of the useful
public Manager methods (130 out of 137) are exposed. (Constructors/destructors are not exposed)
+
- Install SMC (http://smc.sf.net) , and Poco (http://www.pocoproject.org), both development
versions (with headers)
-- I assume you have Ruby >=1.9.1 installed with RbGCCXML and Nokogiri (gem install rbgccxml)
+
+- I assume you have Ruby >=1.9.1 installed with RbGCCXML and bit-struct (gem install rbgccxml bit-struct)
+
- Inspect the Makefile, change directories (unless your username is ekarak!)
+
- Run make, cross fingers, pop champagne.
+
- The generated code is patched twice (I know, I know, this sucks) in order for the compilation
of the C++ openzwave daemon to succeed:
@@ -50,21 +56,40 @@ stompserver_ng from git:
# sudo ruby1.9.1 setup.rb
Then, run it with the debug flag (stompserver_ng -d). This will launch the STOMP server
which will route all notifications from OZW to anywhere you want it to.
-- Hook up your ZWave USB controller at /dev/ttyUSB0 (sorry its hardcoded for the
- time being, see Main.cpp)
+
+Hook up your ZWave USB controller. Default is set at /dev/ttyUSB0, you can use the
+-p argument to tell ozwd to look for the controller anywhere else
+
+Other ozwd command-line flags are:
+
+ekarak@ekarak-laptop ~/ozw/Thrift4OZW $ ./ozwd --help
+Project Ansible - OpenZWave orbiter:
+ -? [ --help ] print this help message
+ -h [ --stomphost ] arg STOMP server hostname
+ -s [ --stompport ] arg STOMP server port number
+ -t [ --thriftport ] arg Thrift service port
+ -c [ --ozwconf ] arg OpenZWave config/ path (manufacturer database)
+ -u [ --ozwuser ] arg OpenZWave user path (network & configuration state)
+ -p [ --ozwport ] arg OpenZWave driver port (e.g. /dev/ttyUSB0)
+
- Fire up ./ozwd, preferrably in a debugger (gdb ./ozwd)
-The server tries to connect to the Stomp Server (localhost:61613) and then starts
-the OpenZWave engine. When all ZWave processing is done, it also fires up the
+The OpenZWave orbiter tries to connect to the Stomp Server (localhost:61613) and then
+starts the OpenZWave engine. When all ZWave processing is done, it also fires up the
Thrift server at 127.0.0.1:9090, and listens for requests.
-Let's connect from Ruby as an example. First edit ozwthrift.rb and fill in the correct
-HomeID for your controller. Then fire up the Interactive Ruby Shell and load the
-bootup code:
+Let's connect from Ruby as an example. We'll be using the Interactive Ruby Shell to load the
+demo code. It will also load a rudimentary OpenZWave monitor that spits out notifications
+that contain all sort of useful data, along with your ZWave HomeID:
-ekarak@ekarak-laptop:~/ozw/Thrift4OZW$ irb1.9.1
-irb(main):001:0> load 'ozwthrift.rb'
-=> true
+ekarak@ekarak-laptop:~/ozw/Thrift4OZW$ irb1.9.1 -I. -r ozwthrift.rb
+Parsing /home/ekarak/ozw/open-zwave-read-only/cpp/src/Notification.h for enum NotificationType...
+Parsing /home/ekarak/ozw/open-zwave-read-only/cpp/src/value_classes/ValueID.h for enum ValueGenre...
+Parsing /home/ekarak/ozw/open-zwave-read-only/cpp/src/value_classes/ValueID.h for enum ValueType...
+#<OpenZWave::RemoteManager::Client:0x95d3ff0 @iprot=#<Thrift::BinaryProtocol:0x95d4590 @trans=#<Thrift::BufferedTransport:0x95d45cc @transport=#<Thrift::Socket:0x95d461c @host="localhost", @port=9090, @timeout=nil, @desc="localhost:9090", @handle=#<Socket:fd 7>>, @wbuf="", @rbuf="", @index=0>, @strict_read=true, @strict_write=true, @rbuf="\x00\x00\x00\x00\x00\x00\x00\x00">, @oprot=#<Thrift::BinaryProtocol:0x95d4590 @trans=#<Thrift::BufferedTransport:0x95d45cc @transport=#<Thrift::Socket:0x95d461c @host="localhost", @port=9090, @timeout=nil, @desc="localhost:9090", @handle=#<Socket:fd 7>>, @wbuf="", @rbuf="", @index=0>, @strict_read=true, @strict_write=true, @rbuf="\x00\x00\x00\x00\x00\x00\x00\x00">, @seqid=0>
+
+Go ahead and fire commands at OpenZWave, be sure to set your HomeID first:
+irb(main):002:0> HomeID = 0x00001234 (!!!example!!!)
# Get a node's name
irb(main):002:0> OZWmgr.GetNodeName(HomeID, 5)
@@ -106,7 +131,7 @@ irb(main):015:0> OZWmgr.SetValue_UInt8(Rvid,0)
-------------------
STOMP Notifications
-------------------
-Also take a look at monitor.rb, its a basic STOMP client in Ruby listening for OpenZWave
+Also take a look at ozw-monitor.rb, its a basic STOMP client in Ruby listening for OpenZWave
notifications. The script uses the BitStruct library to break down ValueIDs into fields.
Take into account that you should keep all ValueID's in a Hash or Array for subsequent
calls to OpenZWave.
View
@@ -114,7 +114,7 @@ def abspath(path)
puts "\n-----------------------------------------------------------------------"
puts " Missing OpenZWave::Manager method mappings from RemoteManagerHandler:"
puts "-----------------------------------------------------------------------"
- puts "\n\t" + missing.join("\n\t")
+ puts "\n\t" + missing.join("\n\t") + "\n\t"
end
end
Oops, something went wrong.

0 comments on commit cdcf187

Please sign in to comment.