Using Visual Studio 2005 will make H.A.S. pretty easy to build however one key feature is pretty tough, a scenario builder. Fortunately, for us Microsoft has solved that problem and it will come free in future versions of Windows.
Microsoft has been working on a set of foundations for programming called WinFX. It includes managed APIs for Presentation, File System, Communication, Idenitity Management and Workflow. It is this last item Windows Workflow Foundation (WF) that will be a huge boon to H.A.S.
The workflow component contains a workflow engine and even an XML file format called XOML for creating new workflows on the fly. This is huge because one of the problems with home automation systems is that every system is unique from the equipment, wiring, even how the occupants want to use the system. No one is smart enough to figure out everything that a user would want or how they will use the system. With WF that is no longer required. WF will allow H.A.S. to be a collection of components and services bound together using XOML.
Once H.A.S. is deployed the integrator can use XOML to create new scenarios that the user can execute. This is accomplished by picking a type of workflow and building it using Visual Studio.
To test this out I built a couple of test activities to control Premise. If you don't have Premise you can download a 30 day trial from Motorola's Premise site. You will also need the Windows Workflow Foundation from Microsoft and Visual Studio 2005. I am not going to regurgitate an introduction, Microsoft does a great job. Instead, I will show you a quick hello world version using Premise’s MiniBroker. The source can be found here.
Step one is building a Workflow Activity Library once you have installed WF. This will house various activities. The other project to build in the solution is a Sequential Workflow Console Application to test the activities.
To start the library I built a base activity that the get and set activities can inherit. This will enable a single connection to the server for the workflow if it executes all at once. In addition, since checking the connection status it should detect if the minibroker should reconnect (although do not count on this, I believe the status is actual broken).
The next part is writing the get and set activity execute methods. Nothing magically just use the minibroker get and set value method after finding the object. You can use the object path or guid. The property value is a string since Premise will make sure to do the type conversion for you. You will notice in the sample code that I overrode the property value in the get activity. This was so I could mark the property as read only in the property inspector. The last part was to create a validator to minimize the errors in the activities.
To test the activities just build a workflow in the test application. I used localhost and changed a light power state from on to off. I also grab the value and publish it to the console.
Using WF you can easy integrate Premise into a variety of tasks that require access to outside applications, services, or even interactions with people. If you use it drop me a line (rsatter at hageeks dot com).