Detecting the presenceof the CM15A reliably

Started by roschler, December 23, 2009, 05:24:11 PM

Previous topic - Next topic

roschler

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.

Tuicemen

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.
>!
Please Read Topic:
General Forum Etiquette
Before you post!

roschler

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.

Tuicemen

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!
Please Read Topic:
General Forum Etiquette
Before you post!

roschler

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

Thanks.

Tuicemen

Quote from: roschler on December 24, 2009, 02:30:08 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:
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.
>!
Please Read Topic:
General Forum Etiquette
Before you post!

EL34

#6
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  :)

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

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"
>!
Please Read Topic:
General Forum Etiquette
Before you post!

BitsNBytes

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 */
        }


SMF spam blocked by CleanTalk