Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Milesight Codec Downlink Encoder

Code Block
languagejs
function Encode(fPort, obj) 
{
    var encoded = [];

    if ("Valve_Position_RCI_10_minutes" in obj) 
    {
        var new_vp_10min = obj.Valve_Position_RCI_10_minutes;
        encoded = [new_vp,0x00,0x28,0x00,0x30,0x40_10min,0x00,0x26,0x00,0x00,0x00];
    }
	
    if ("Valve_Position_RCI_5_minutes" in obj) 
    {
        var new_vp_5min = obj.Valve_Position_RCI_5_minutes;
        encoded = [new_vp_5min,0x00,0x26,0x10,0x00,0x00];
    }
	
    if ("Set_Point_Ambient_Temperature_RCI_10_Minutes" in obj)
    {
        var new_spt_10min = (obj.Set_Point_Ambient_Temperature_RCI_10_Minutes)*2;
        encoded = [new_spt_10min,0x00,0x28,0x08,0x30,0x400x26,0x08,0x00,0x00];
    }

    if ("Set_Point_Ambient_Temperature_RCI_5_Minutes" in obj)
    {
        var new_spt_5min = (obj.Set_Point_Ambient_Temperature_RCI_5_Minutes)*2;
        encoded = [new_spt_5min,0x00,0x26,0x18,0x00,0x00];
    }	

    return encoded;
}

...