Example #1
0
    //==============================================================================
    /// <summary>
    /// Build a requestSetvalue message.
    /// </summary>
    /// <param name="iLocalSetPropID">Local identifier for the property.</param>
    /// <param name="Value">Value to which to set the property.</param>
    /// <returns>The new message. If this function fails then the returned message.msgID==0</returns>
    //==============================================================================
    protected TMsgHeader buildRequestSetMsg(int iLocalSetPropID, TTypedValue Value)
    {
        uint            valSize;
        TSetterProperty localProp = null;
        TMsgHeader      newMsg    = new TMsgHeader();

        newMsg.msgID = 0;   //default to fault

        valSize = Value.sizeBytes();
        byte[] valPtr = new byte[valSize];
        Value.getData(ref valPtr);

        //destination is the owning system
        interpreter.setField(Msgs.MSG_REQUESTSET_ID, iLocalSetPropID);      //local reg property ID
        interpreter.setField(Msgs.MSG_REQUESTSET_TYPE, localProp.sDDML);
        interpreter.setField(Msgs.MSG_REQUESTSET_VALUE, valPtr, valSize);
        newMsg = interpreter.createMessage(Msgs.MSG_REQUESTSET, parentID);
        return(newMsg);
    }