Posts Tagged ‘Forum’

Improved Z-Wave message handling in C#

February 6th, 2010 | Edit

In this article a queue is implemented to allow the device objects to request messages to be send at any time. The messages are enqueued and then send to the Z-Wave controller when possible.
An additional thread is created to decouple the sending and receiving of messages. It will dequeue messages from the SendMessage queue and send them to the Z-Wave controller.
The entire discovery functionality will be moved to the Controller class and a mechanism is provided to allow other objects to subscribe to events concerning updates to the Z-Wave network e.g. added nodes.

class ZWavePort
{
    public delegate void MessageHandler(byte[] sentMessage, byte[] receivedMessage);
 
    ...
 
    private Thread senderThread
 
    ...
 
    private PriorityQueue<zwavemessage , ZWaveMessagePriority> queue = new PriorityQueue</zwavemessage><zwavemessage , ZWaveMessagePriority>();
 
    ...
 
}
 
class Controller : ZWaveNode
{
    public event DiscoveryEventHandler DiscoveryEvent;
 
    ...
 
    private Dictionary<byte , ZWaveNode> devices = new Dictionary</byte><byte , ZWaveNode>();
 
    ...
 
    public void EnqueueMessage(ZWaveMessage message)
    {
        queue.Enqueue(message, message.Priority);
    }
 
    ...
 
}</byte></zwavemessage>

» Read more: Improved Z-Wave message handling in C#

Z-Wave device discovery in C#

January 14th, 2010 | Edit

This article will cover the C# implementation of the protocol discussed in ‘Device discovery in Z-Wave‘.
The actual changes caused by the new requests are limited to a reimplementation of the callback id. Not all responses support the callback id and this affects the completion of the message sequences.
The real challenge is connected to the fact that the messages send from Z-Wave controller to the C# client are used for more than completing the message sequences – the content itself is interesting as it reveals information about the devices connected to the Z-Wave network.

The identification of Z-Wave devices basically consists of two new requests.

  • Ask for the node ids in the Z-Wave network (discovery)
  • Ask for the type of each node

A Controller is added to the device classes.

class Controller : ZWaveNode
{
    ....
 
    public void Discovery()
    {
        ...
    }
 
    public void GetNodeTypes(byte nodeId)
    {
        ...
    }
 
    ....
 
}

» Read more: Z-Wave device discovery in C#

Forum at digiWave.dk

January 12th, 2010 | Edit

The new forum is now available at digiWave.dk.

The purpose is to centralize the discussion about Z-Wave software development. The idea is to complement sites like ZWave.dk og Domoticaforum.eu.

The forum will be updated as articles about new topics are being published at digiWave.dk.