Difference between revisions of "DCE from commandline"

From LinuxMCE
Jump to: navigation, search
m (Shift section degrees down to start at 1)
Line 1: Line 1:
 
[[Category: Programmer's Guide]]
 
[[Category: Programmer's Guide]]
==Sending DCE events from command line==
+
=Sending DCE events from command line=
 
There is a utility in pluto (/usr/pluto/bin) that allows sending proper DCE message from command line. If you want for instance to trip motion sensors on/off you can achieve this in simple way (ID means ID of particular device that you send event for) :
 
There is a utility in pluto (/usr/pluto/bin) that allows sending proper DCE message from command line. If you want for instance to trip motion sensors on/off you can achieve this in simple way (ID means ID of particular device that you send event for) :
  
Line 35: Line 35:
 
  /usr/pluto/bin/MessageSend dcerouter 210 -1000 2 48 10 1
 
  /usr/pluto/bin/MessageSend dcerouter 210 -1000 2 48 10 1
  
==Sending DCE commands from command line==
+
=Sending DCE commands from command line=
  
 
Change HouseMode command :
 
Change HouseMode command :
Line 78: Line 78:
  
  
==Other interesting DCE messages==
+
=Other interesting DCE messages=
  
 
Will parse the meaning of DCE messages below  in future. Just wrote it here to remember....
 
Will parse the meaning of DCE messages below  in future. Just wrote it here to remember....

Revision as of 00:30, 22 January 2008

Sending DCE events from command line

There is a utility in pluto (/usr/pluto/bin) that allows sending proper DCE message from command line. If you want for instance to trip motion sensors on/off you can achieve this in simple way (ID means ID of particular device that you send event for) :

Event "tripped on"

ID -1000 2 9 25 1

Event "tripped off"

ID -1000 2 9 25 0

Event "temperature changed"

ID  -1000 2 25 30 temperature_value

Event "output on"

ID  -1000 2 28

Event "output off"

ID  -1000 2 29

Event "light on"

ID  -1000 2 48 10 1

Event "light off"

 ID  -1000 2 48 10 0

For instance -

A. tripping security sensor with ID of 195 to ON :
/usr/pluto/bin/MessageSend dcerouter 195 -1000 2 9 25 1
B. play media (/home/public/data/tts/0.wav) on Xine player with ID of 44 :
/usr/pluto/bin/MessageSend localhost 0 44 1 37 29 "" 41 "" 42 "" 59 "/home/public/data/tts/0.wav"
C. report that light with ID of 210 is ON :
/usr/pluto/bin/MessageSend dcerouter 210 -1000 2 48 10 1

Sending DCE commands from command line

Change HouseMode command : I've sniffed DCERouter logs and this is what happens when you change security state from Orbiter :

06      09/11/07 16:06:53.512           Evaluated Event Handler: 1 to: 0 once per: 0 last fired 1189519147 (time is 1189519613)
07      09/11/07 16:06:53.512           Received Message from 13 (Security Plug-in / Utility) to -1001 (unknown / ), type 2 id 43 Event:House Mode  Changed, parameters:
07      09/11/07 16:06:53.512             Parameter 38(PK_DeviceGroup): 0
07      09/11/07 16:06:53.512             Parameter 39(PK_HouseMode): 1
08      09/11/07 16:06:53.512           Received Message from 13 (Security Plug-in / Utility) to Apex Destiny 6100(217), type 1 id 19 Command:Set  House Mode, parameters:
08      09/11/07 16:06:53.512             Parameter 5(Value To Assign): 1
08      09/11/07 16:06:53.512             Parameter 17(PK_Users): 7
08      09/11/07 16:06:53.512             Parameter 99(Password): 5678
08      09/11/07 16:06:53.512             Parameter 100(PK_DeviceGroup): 0
08      09/11/07 16:06:53.512             Parameter 101(Handling Instructions): R
08      09/11/07 16:06:53.513           Received Message from 13 (Security Plug-in / Utility) to OnScreen Orbiter(20),tinia Symbian Series 60 mobile(31),Lapitopi(38),OnScreen Orbiter(40),OnScreen Orbiter(88),Windows XP PC/tablet (Horiz)(102),Generic Proxy Orbiter(164),Windows XP PC/tablet (Horiz)(170),HC Center(174),Ati Symbian Series 60 mobile(247), type 1 id 8 Command:Remove Screen From History, parameters:
08      09/11/07 16:06:53.513             Parameter 10(ID):
08      09/11/07 16:06:53.513             Parameter 159(PK_Screen): 13
05      09/11/07 16:06:53.513           The target device 217 (routed to 217) has not registered.
13      09/11/07 16:06:53.513           No response expected.  returning

But sending this command from command line doesn't work :

/usr/pluto/bin/MessageSend localhost 0 -1000 1 19 5 2 17 7 99 5678 100 0 101 R

Also sending event House Mode Changed doesn't actually change house mode (that's ok, cause events are meant for notifying):

/usr/pluto/bin/MessageSend localhost 0 -1000 2 43 38 0 39 2


I have found out the reason. -1000 is DCERouter address, but this kind of message should be addressed directly to Security plugin - in my case this is ID of 13. I'm following this, although don't understand distinction of -1000 and 13 - if DCERouter is addressed it should relay message to security plugin anyway - so I don't understand why this is necessary - any opinion ?

As far as I can tell, the reason for '-1000' is to allow devices to broadcast events to the system as a whole rather than to a specific device, presumably for event-based devices that do not do a specific function. I shall look more into this... -AVJohn.
/usr/pluto/bin/MessageSend localhost 0 13 1 19 5 6 17 7 99 5678 100 0 101 R

Now it changes security mode properly... Parameters in this command line are : 0 from, 13 to Security plugin, 1-Type: Command, 19-Command "Set house mode", and the rest:

08      09/11/07 16:06:53.512             Parameter 5(Value To Assign): 1
08      09/11/07 16:06:53.512             Parameter 17(PK_Users): 7
08      09/11/07 16:06:53.512             Parameter 99(Password): 5678
08      09/11/07 16:06:53.512             Parameter 100(PK_DeviceGroup): 0
08      09/11/07 16:06:53.512             Parameter 101(Handling Instructions): R


Other interesting DCE messages

Will parse the meaning of DCE messages below in future. Just wrote it here to remember....

It seems like "Goto Screen" command

/usr/pluto/bin/MessageSend localhost 0 64 1 741 10 "Whatever" 159 53 9 'A message|Ok|Remind me later' 137 '-targetType device <%=!%> 15 1 67 13 "/root/Something.sh" 51 "--answer yes"|-targetType device <%=!%> 15 1 67 13 "/root/Something.sh" 51 "--answer no"'

To display Text Alert on Orbiter :

/usr/pluto/bin/MessageSend localhost 0 20 1 809 9 "Text to Display" 70 "alert" 182 "30" 251 "??"

Also interesting command is #397 "Show popup", but I have yet to discover how to use it...

Does anyone know how to display popup with question and few answer buttons (yes/no for example) ? Can this be done without Designer to create screen - just to specify question, texts on buttons and actions on click ?