LinuxMCE Forums
May 22, 2013, 09:58:11 pm GMT-1 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com
 
   Home   Help Search Chat Login Register  
Pages: [1]
  Print  
Author Topic: How do I get to Device data in a C++ DCE device? [solved]  (Read 1190 times)
ajward
Regular Poster
**
Posts: 20


View Profile
« on: January 23, 2009, 01:33:52 am »

Hi,

Sorry if there's a simple answer in an obvious place for this, but I couldn't find it!

I have a USB DCE device (it's the Dusky Control USB Sky device), and I have it working (Hurrah!).

...but the implementation only works with one device, because I can't translate the box_num/device_num identification system used by the Dusky software to what I need.

The solution seems to be to parse the /dev/bus/usb/nnn/mmm string that LinuxMCE generates against the Device Data/Block Device parameter when it auto-detects the device.

I've found that data in the database, but I can't work out how to get retrieve it given only the DeviceID. I could use sqlCpp and query it directly, but surely there's a utility method for doing this?

I suspect it might have something to do with ::GetConfig() and the DATA_ configuration parameters, but I can't work out the calls to make from the code.

Can anyone find it in their hearts to help me out with a simple example, please?

TIA
Andy W.
« Last Edit: February 28, 2009, 06:19:04 pm by ajward » Logged
darrenmason
Addicted
*
Posts: 529


View Profile
« Reply #1 on: January 23, 2009, 04:36:51 am »

Andy,

If "Block Device" is device data defined (and populated) in your Device Template or any of the Device Template's in the inheritance heirarchy then you will have an auto generated accessor method.

This will be defined in the generated header file in Gen_Devices. eg: if your device  template is XXX then look in Gen_Devices/XXXBase.h

I 'think' this is what you are asking.

HTH
Darren
Logged
hari
Administrator
LinuxMCE God
*****
Posts: 2413



View Profile WWW
« Reply #2 on: January 23, 2009, 09:43:33 am »

you can also talk to the info plugin to get/set device data for other devices, e.g.:

Code:
CMD_Set_Device_Data cmd_Set_Device_Data(m_dwPK_Device, 4, PKDevice, sCapabilities.c_str(), DEVICEDATA_Capabilities_CONST);               
SendCommand(cmd_Set_Device_Data);

br, Hari
Logged

rock your home - http://www.agocontrol.com home automation
ajward
Regular Poster
**
Posts: 20


View Profile
« Reply #3 on: January 26, 2009, 02:27:46 pm »

Thanks guys, that's just what I need.

I'll give that a try!

Cheers,
Andy Ward.
Logged
ajward
Regular Poster
**
Posts: 20


View Profile
« Reply #4 on: February 13, 2009, 06:08:09 pm »

Thanks guys, with that bit of guidance, works a treat.

What I was missing was that just because a device reports a Block_Device parameter in the device tree, doesn't mean you can get to that parameter via an access method. The access method is only present if you add the parameter Block_Device against the device template.

Obvious now I know  Smiley.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!