Premise HDSK - Visual Studio's SP1 breaks the Premise Wizard.

Motorola Premise

123

Senior Member
FYI:
I discovered that if you install Visual Studio 2005's Service Pack 1, it will damage the Premise Device Wizard.

The HDSK provides several resources for a driver developer, including two wizards for Visual Studio 2005:
  • one builds the Premise Driver project
  • another adds Device classes
VS 2005's SP1 damages the second wizard. Attempts to run the "Add Class" command, to a add a new Premise Device class to your driver, will result in an error message concerning this template file:
Program Files\Microsoft Visual Studio 8\VC\VCWizards\Premise\PremiseDeviceWizard\templates\1033\sysdev.h

I don't know enough about creating Visual Studio Wizards to debug the problem. I uninstalled "Premise C++ Driver Wizards for Visual Studio 2005" and " Visual Studio 2005" (with SP1), re-installed everything minus SP1, and that restored the functionality of the Device Wizard.

There's probably a way to fix the template file so it can work with SP1, maybe even a way of making the Wizard files work with Visual Studio 2008 ... but that's for another interpid soul. I already feel like the last guy on the planet using the HDSK. When your Google searches come up empty-handed, you know you're poking at the fringes of shared knowledge.
 
No, you're not the only one.

I tried to run through the demo a few months ago. I got the same error you did when trying to create a class. I gave up, because I am the opposite of an intrepid soul. I meant to post my experience, but I was too embarrased. Thanks for discovering this. When I get some spare time I'll reinstall, too, and try to make it through. My goal is to create a driver for Sony receivers. I got the source from a really old post on the Premise board.

-Tom
 
No need to be embarassed, Tom ... had you posted your experience you would've saved me a heckuva lot of time! :)

Yep, the Device Wizard works well if you use VS 2K5 without SP1.

BTW, the learning curve for creating native drivers (using the C++ SDK) is substantially longer than for Module-based drivers. If the Sony device communicates via a serial or TCP/IP port, using a text or binary protocol, then you can write a Module with VBScript (faster development cycle). There are many examples available including my ELK M1 driver. If the device can only be controlled via IR commands, then you can use Builder's template-based Class Wizard to generate the skeleton of a driver and then populate it with appropriate Pronto codes.

If you intend to build a Module-based driver, you definitely need to put Builder in Expert Mode. While in Modules, click on any item in the Content Workspace and then press Ctrl+Shift+A. This mode disables Builder's Class Wizard and lets you define new classes, methods, functions, and relationships (inheritance/extension) from scratch.

FWIW, I'm writing a driver for a USB-UIRT. I'm using the C++ SDK because the programming interface to the UIRT is via a DLL (uuirtdrv.dll) involving callback functions ... and VBScript can't handle those requirements.

Another option is to use Premise's Minibroker interface. You write a standalone application, in JavaScript or any .NET language (anything that can talk to a COM object), that runs on the Premise server or on a remote computer. Your app communicates with Premise server via Minibroker and has full access to all objects in Premise's data store, classes, methods, etc. "John in VA" wrote his Insteon driver using the Minibroker interface.

Good luck with your driver and let us know about your progress!
 
I encountered this as well a couple months back when I decided to write a driver for Premise. If I recall, I got the wizard to work with VS 2005 SP1 after modifying a couple lines in one of the header files used by the wizard. If you're interested, I can try to find those modifications and post them here. Then you could use the wizards with VS 2005 SP1.

I definitely would rather have the wizards work on VS 2008. Since I wanted to work in VS 2008, I first created my project in VS 2005 SP1 using the wizards, then opened the project in VS 2008 and let it convert the project to a VS 2008 project. Then I did the rest of my development using VS 2008.

Frank
 
Frank,

Am I interested? You bet I am! Please share the mods needed to make the driver wizard work with VS2005 SP1.

Converting the wizard to work in VS 2008 would be ideal, but until someone figures out a way to do that, your workaround (VS2008 upscaling) sounds like an acceptable compromise.

A few questions for you:
  1. Can you elaborate on the kind of driver you created?
  2. Can you share the code with the Premise community?
  3. Are you available to answer a few questions about the SDK (see below)?
So far I've:
  • Read the SDK doc
  • Studied the source code for the UPB, ALC, and Panja drivers
  • Analyzed the XML structure of existing drivers
  • Completed the HelloWorld driver
  • Wrote a rudimentary, 'proof-of-concept' USB-UIRT driver
However, there a few things I haven't been able to figure out like:
  1. How do you get a driver to inherit Logging capabilities?
    I figured it out. Normally, Logging is automatically inherited from TransportBase. My USBUIRT driver doesn't use the TransportBase class because it doesn't use Premise's serial or TCP/IP services; the driver communicates via the UUIRTDRV.DLL from the USBUIRT's SDK. So my driver needs to explicitly inherit the Logging class ("sys://Schema/System/Logging").
  2. Should the driver be initialized during OnBrokerAttach or OnDeviceState?
  3. What's the best way to implement a driver watchdog function? I've seen OnHeartbeat and OnPing described in VS's Object Browser but it isn't clear to me.
 
Find the sysdev.h file on your installation and then make these changes:


1c1
< // [!HeaderName] : Declaration of the [!ClassName]
---
> // [!output HEADER_NAME] : Declaration of the [!output CLASS_NAME]
13c13
< // [!ClassName]
---
> // [!output CLASS_NAME]
127c127
< //These are example properties. You should edit [!ProjectName].xml and add properties
---
> //These are example properties. You should edit [!output PROJECT_NAME].xml and add properties

Although I have a lot of experience writing DLLs for Windows, I have very little experience with the Premise HDK. And as much as this interests me I'm sorry to say my "real job" leaves me very little free time to tinker with this. I did the bare minimum amount of work to get stuff working well enough for me and I'm afraid my code probably is not a good example. In any case, I'm more than happy to share anything I've learned that could be of value but I'd hesitate to just drop my source or drivers here in full for use as any sort of reference, as they are probably littered with mistakes.

I wrote two drivers. First for the AquaController Jr., which is a programmable controller for saltwater aquariums (see http://www.neptunesys.com/). It monitors temperature and other water parameters and can control devices (e.g. aquarium lighting, pumps, water heaters, chillers, etc.) through connected relay-controlled power outlets. It has a serial port with a simple serial protocol allowing software to read current settings or control power to the connected devices. I wanted to allow Premise to read the aquarium temperature and the state of the devices (lighting, heaters, pumps) for display in the browser, and also control some of the devices.

The other device wasn't really a device. It's a rudimentary "bridge" between Premise and HomeSeer2. So there are really two drivers involved here- a Premise driver and a HomeSeer2 driver- that communicate with each other. It allows some devices defined in HomeSeer2 to appear as simple on/off devices in Premise. This lets me run, for example, HomeSeer2 with its production Insteon driver and integrate control of some of those Insteon devices into my Premise system.

Let me know if the sysdev.h changes work for you or if you have more questions about what I've done.

Frank
 
I modified sysdev.h as per your instructions, updated VS 2005 to SP1 and the Device Wizard is working properly. Many thanks!

BTW, if you've implemented Logging using the CLogger class, I wouldn't mind seeing a snippet of the code. The SDK describes CLogger's methods but doesn't provide any examples.
 
I modified sysdev.h as per your instructions, updated VS 2005 to SP1 and the Device Wizard is working properly. Many thanks!

Ditto. Thanks, Frank. Can you tell us how you came to discover the problem, and the fix?

-Tom
 
In this case, I just used “divide and conquer”. The error message indicated a problem in sysdev.h. So I commented out large parts of that file until it no longer produced an error message (although obviously it wouldn’t generate useful code in that state). I then restored portions of the code until I finally narrowed it down to the offending lines.

123, I haven't done anything with the CLogger class so I'm sorry don't have any insight there.

Frank
 
Back
Top