Menu

ActionCommand

Help
Nelson V.
2015-05-08
2015-05-08
  • Nelson V.

    Nelson V. - 2015-05-08

    Hi,

    I'm currently trying to implement some methods which should handle Command objects writing capabilities, including setting action properties. I've already implemented the writing functionality for all the properties but I'm having troubles when trying to write actions.

    The issue that I'm having has to do with the inclusion of some context specific tags around the ActionCommand propertyValue field, which acording to wireshark and also VTS are invalid. From looking at the byte queue in Wireshark, these "extra" bytes are the PropertyIdentifier and pirority fields (array index is null) added in the PropertyValue, which are also added in the ActionCommand itself.

    I suppose these shouldn't be added twice and that adding them in the PropertyValue encoding is the problem, but I also tried to add a Primitive (Real) encodable as property value and that didn't solve the issue.

    This is what I'm doing (regarding ActionCommand only):

    PropertyValue propValue = new PropertyValue(
                    propIdentifier,
                    propArrayIndex,
                    value, //Float or whatever
                    priority);
    
    ActionCommand actionCommand = new ActionCommand(                
                    deviceIdentifier,
                    objIdentifier,
                    propIdentifier,
                    propArrayIndex,
                    propValue,
                    priority,
                    postDelay,
                    new Boolean(bacActionCommand.getQuitOnFailure()),
                    new Boolean(bacActionCommand.getWriteSuccessful()));
    

    Is this the correct way of setting the ActionCommand?

    The byte sequence that I get is like this:

                                       |                                (PropertyValue)                            |
                                                             |        (Primitive (Real))       |
    Open Tag    Object ID     Prop. ID   Open Tag   Prop. ID  Open Tag  Type + Value  Close Tag  Priority  Close Tag
       0e     1c 00 40 00 00   29 55        4e        09 55      2e    44 41 20 00 00     2f       39 08      4f
    

    The "BAD bytes" according to Wireshark and VTS are the "09 55" after the PropertyValue Open tag and also the Open and close tags of the PropertyValue Primitive.

     

    Last edit: Nelson V. 2015-05-08
  • Matthew Lohbihler

    There is a bug in ActionCommand.write(ByteQueue). The line:

        write(queue, propertyValue, 4);
    

    ... should be:

        writeEncodable(queue, propertyValue, 4);
    

    The correct property value to set in the action command the is the same type as the property in the target object to which you are writing. Here is an example:

        ActionCommand ac = new ActionCommand( //
                new ObjectIdentifier(ObjectType.device, 234), //
                new ObjectIdentifier(ObjectType.analogValue, 0), //
                PropertyIdentifier.presentValue, //
                null, new Real(3.14F), null, null, Boolean.FALSE, Boolean.FALSE);
        ActionList al = new ActionList(new SequenceOf<ActionCommand>(ac));
        WritePropertyRequest req = new WritePropertyRequest( //
                new ObjectIdentifier(ObjectType.command, 0), //
                PropertyIdentifier.action, new UnsignedInteger(1), al, null);
    

    Regards,
    Matthew

     
  • Nelson V.

    Nelson V. - 2015-05-08

    Hi Matthew,

    First of all thank you for your quick answer.

    And, yes, I can confirm that the change on ActionCommand.write(ByteQueue) you mentioned solves the issue, so thanks again.

    Cheers,
    Nelson

     
  • Matthew Lohbihler

    Thanks for the confirmation Nelson.

    Reagrds,
    Matthew Lohbihler

     

Log in to post a comment.