Author Topic: How do you get a device's name?  (Read 1876 times)

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
How do you get a device's name?
« 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

The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: How do you get a device's name?
« Reply #1 on: December 24, 2007, 11:24:37 am »
bUmP
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: How do you get a device's name?
« Reply #2 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?
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

MarcoZan

  • Veteran
  • ***
  • Posts: 148
    • View Profile
Re: How do you get a device's name?
« Reply #3 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

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: How do you get a device's name?
« Reply #4 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
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

MarcoZan

  • Veteran
  • ***
  • Posts: 148
    • View Profile
Re: How do you get a device's name?
« Reply #5 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

ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: How do you get a device's name?
« Reply #6 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
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

MarcoZan

  • Veteran
  • ***
  • Posts: 148
    • View Profile
Re: How do you get a device's name?
« Reply #7 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:

Code: [Select]
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:
Code: [Select]
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