LinuxMCE Forums

General => Developers => Topic started by: ddamron on December 23, 2007, 07:08:00 AM

Title: How do you get a device's name?
Post by: ddamron on December 23, 2007, 07:08:00 AM
I'm trying to display human readable names of the devices..
Anyone know how to read the device's name?
eg:  my device #40 is type Switch (dimmable)
but I've named it 'Office Light'

How do I get 'Office Light' from device #40?
(of course, GSD in Ruby)

something like device_.childdevices_[40].?????

Thanks.

Dan

Title: Re: How do you get a device's name?
Post by: ddamron on December 24, 2007, 11:24:37 AM
bUmP
Title: Re: How do you get a device's name?
Post by: ddamron on December 29, 2007, 01:01:58 AM
Still trying to figure this out...
While I'm at it, How can I get a device's Room?
Title: Re: How do you get a device's name?
Post by: MarcoZan on August 23, 2008, 09:46:10 PM
Hi Dan

sorry to bump an old thread .... but did you ever figure out how to access to devices names from GSD-Ruby?
And what about accessing a device Room?

TIA

Marco
Title: Re: How do you get a device's name?
Post by: ddamron on August 24, 2008, 09:45:41 PM
well, it's been a long time since I've seen this thread...

of the top of my head, and scanning the DCE Commands, there's a command to do it.
cmd[68] Get Device Data
cmd.params[2] = deviceID
cmd.params[52] = devicedata you want to retrieve
cmd.params[53] = false
sendcommand
name is returned in cmd.params[5]

that should do it!
wow, i must have learned something, that was only a 2 minute solution,
cool!

regards,

Dan
Title: Re: How do you get a device's name?
Post by: MarcoZan on August 25, 2008, 12:20:48 AM
Hi Dan and thanks for your reply

I got more or less your point, will try your suggestion very shortly and let you know.

By the way, you mention somehow a list of DCE Commands. Can you point me to some docs where I can find such info ? Wiki does not seem to have anything about DCE (at least anything with the needed detail), so some pointers to docs about DCE Commands would be really valuable for any developer (or anyone pretending to be one of them ... like me ...)

Thanks and regards
Marco
Title: Re: How do you get a device's name?
Post by: ddamron on August 25, 2008, 04:52:33 AM
yeah, webadmin :)

or more specifically, the Advanced (at the top), DCE, then you choose:
Commands,
Events,
Device Data

from there it should be pretty self explanatory

BTW, thanks for waking this thread up, I've been meaning to get to a DCE webcast, and this kinda poked me into that direction :)

All the best,

Dan
Title: Re: How do you get a device's name?
Post by: MarcoZan on August 25, 2008, 03:14:45 PM
Thanks Dan

I feel a little dumb for asking a question that could answer myself by just looking webadmin ...

Nevertheless, back to business.

I tried to use cmd 68 (Get Device Data), but there's still something wrong in the way I'm using it because I can't get params_[5] that is supposed to hold the Name of the device.

My code is:


tmpCmd = Command.new(cmd.devidto_ , -1000 , 0, 1, 68)
tmpCmd.params_[2] = cmd.devidto_.to_s
tmpCmd.params_[52] = 156.to_s
tmpCmd.params_[53] = false.to_s
SendCommand(tmpCmd)

I'm running this code from Process Receive Command for Child, so cmd.devidto_ is the device # of a child of my GSD. Basically I'm sending DCE router a command in order to get child device name.
params_[52] contains the PK_DeviceData of "Name" parameter (deduced from DeviceData table).
What I'm expecting after SendCommand is to be able to access to params_[5] and find the child name in it, but things are not going like this.

DCE Router simply says:

Received Message from 67 (Luce Studio / Studio) to -1000 (unknown / ), type 1 id 68 Command:Get Device Data, retry none, parameters: <0x84fcbb90>
08 08/25/08 14:55:15.198   Parameter 2(PK_Device): 67 <0x84fcbb90>
08 08/25/08 14:55:15.198   Parameter 52(PK_DeviceData): 156 <0x84fcbb90>
08 08/25/08 14:55:15.198   Parameter 53(UseDefault): false <0x84fcbb90>

If I try to access to tmpCmd.params_[5] I get a runtime error, as the variable does not exist.

What the hell am I doing wrong?

TIA
Marco