Please login or register.

Login with username, password and session length

Author Topic: Detecting the presenceof the CM15A reliably  (Read 9803 times)

roschler

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 9
Detecting the presenceof the CM15A reliably
« on: December 23, 2009, 05:24:11 PM »

I will be adding a wizard to my X10/CM15A based program to help users install and configure the application.  I want to be able to:

- Detect the presence of the drivers necessary for my software via the SDK to interface with the CM15A.  That way if they are not installed I can tell the user to go download and install them or get a CM15A if they don't have one.  Also I would like to be able to retrieve the version number of the drivers so I can recommend an update to the user if the drivers they have are old.

- (Once the driver test has been passed).  Detect the presence of the CM15A reliably so I can make sure the user has one connected and it is working properly.

Are there SDK commands to do this?  If not, are there other ways like using the Windows API or other methods for doing this?

Thanks in advance.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!
Re: Detecting the presenceof the CM15A reliably
« Reply #1 on: December 23, 2009, 06:24:07 PM »

Depending on what your coding in it is possible with simple try catch coding. If it fails the catch throws a pop up stating "A C15 is needed for Home Automation!" or something simular.
If AHP is installed they will have the updated drivers.
 >!
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

roschler

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 9
Re: Detecting the presenceof the CM15A reliably
« Reply #2 on: December 23, 2009, 07:44:53 PM »

Hello Tuicemen,

Can you give some more details?  Simply relying on a failure doesn't narrow down the cause enough for me as far as I can see.  If a call fails because the driver is not installed, will the SDK throw a specific error to that, different from what it would do if the drivers are installed by the CM15A is not attached, etc.?

Thanks.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!
Re: Detecting the presenceof the CM15A reliably
« Reply #3 on: December 23, 2009, 08:23:45 PM »

Depending on what call you make yes! ;)
If you let us know what language your programing in someone here I'm sure will jump in with some sample code!
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

roschler

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 9
Re: Detecting the presenceof the CM15A reliably
« Reply #4 on: December 24, 2009, 02:30:08 AM »

Any sample will do.  I know C, C++, Object Pascal, Visual Basic, Javascript, PHP, Prolog, Java, and a little ASM.

Thanks.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!
Re: Detecting the presenceof the CM15A reliably
« Reply #5 on: December 24, 2009, 10:33:22 AM »

I know C, C++, Object Pascal, Visual Basic, Javascript, PHP, Prolog, Java, and a little ASM.
I'm not sure I should be the one helping you! ::) :'
If your creating a wizard that loads before the program its self then detecting if the drivers are present won't be a problem!
in VB  a line like:
 
Code: [Select]
Try
            Dim ObjAH = New ActiveHome
        Catch
            MsgBox("You need X10 Drivers!")
        End Try
Will be needed as with out the messagebox it throws a general error if no drivers are found.
Of coarse you could include the SDK redistributionables with your build they are in the SDK. ;)

Your program will load without A X10 device attached to the PC if drivers are present. ;)

I believe there are commands in the X10nets for device discovery. If I remember right there is a thread in this section that deals with it
I've never tried that. Read the threads in this section may yield a code sample to give you a starting point a lot quicker then waiting for someone to respond.
 >!
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Detecting the presenceof the CM15A reliably
« Reply #6 on: January 02, 2010, 07:25:16 AM »

I have never written any code that looks for a driver itself, but you can certainly look for file names.

In VB.net, using Try / Catch coding in all the proper spots will catch any errors ahead of time.

There is a process running all the time on my X10 pc called x10nets.exe
You can test to see if that service is running in VB.net
If that service is running, then x10 must be installed and working. (assumption on my part)

I would just do some testing using a simple x10 program to test your code on a pc that does not have x10 installed
This will flush out all the possible problems your users may encounter.

I like real world testing  :)

« Last Edit: January 02, 2010, 07:32:30 AM by EL34 »
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!
Re: Detecting the presenceof the CM15A reliably
« Reply #7 on: January 03, 2010, 09:40:40 AM »

Actually you could use the "if file exists" to see if drivers are installed as well!
Most X10 Software puts some info in C:\Program Files\Common Files\X10 either in the sub folder "Common"  or "DriverInstall"
 >!
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

BitsNBytes

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 25
Re: Detecting the presenceof the CM15A reliably
« Reply #8 on: March 02, 2010, 10:30:38 PM »

Not sure exactly what you are looking for but if you want to know if the .DLL (COM interface) is installed you can simply try to create a connection to the object. If you are using VC++ if would look something like this:

    ActiveHomeScriptLib::IActiveHome* m_pActiveHome;
    HRESULT hr;

    hr = CoCreateInstance (__uuidof (ActiveHomeScriptLib::ActiveHome), NULL, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER,
                                    __uuidof (ActiveHomeScriptLib::IActiveHome), (LPVOID *)&m_pActiveHome);

    if (FAILED(hr))
        {
        /* no com drivers registered */
        }

 
Logged
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.