Contact Us

    If you still have questions or prefer to get help directly from an agent, please submit a request.
    We’ll get back to you as soon as possible.

    Please fill out the contact form below and we will reply as soon as possible.

    • Digital Matter Site
    • Contact Us

    Turn a Digital Output on/off - 0x004

    Written by Matthew Clark-Massera

    Updated at March 26th, 2025

      Contact Us

      If you still have questions or prefer to get help directly from an agent, please submit a request.
      We’ll get back to you as soon as possible.

      Contact Support
      • Home
      • Device Manager
      • Device Manager API
      • Device Control - Asynchronous Messages

      Table of Contents

      Before you start Description How to use Payload: cURL Example: curl -X 'POST' \ 'https://api.oemserver.com/v1/AsyncMessaging/Send?serial=439705' \ -H 'accept: text/plain' \ -H 'Authorization: Basic bWF0dGNAZGlnaXRhbG1hdHRlci5jb206dnMyaDZxWVQ3eDJM' \ -H 'Content-Type: application/json' \ -d '{ "MessageType": 4, "CANAddress": 4294967295, "ExpiryDateUTC": "2025-03-28T13:27:05.246Z", "SendAfterDateUTC": "2025-03-26T13:27:05.246Z", "Flags": 0, "Data": [15,15,6,0] }' Response

      Before you start

      Ensure you have reviewed:

      • Welcome to the Device Manager API 
      • Device Manager ASYNC Messaging Architecture
       

      Description

      0x004 - Set Digital Output. 

      For detail on device outputs, see: Common Concepts - Digital Outputs and Remote Output Control

      This message remotely sets digital outputs on a device. The output numbers are physical outputs (no logical remapping). The firmware translates the logical level into a physical level depending on the active high setting in system parameters. The changed mask allows the server to change required outputs and not affect others.

      For this message to have any effect - the output being changed must be set up as Digital Output under the Digital Output parameters. 

      How to use

      Outputs are used for a variety of purpose. Often to immobilize a vehicle. If we are using the output for this purpose, we would set the output function as Immobilizer - and instead use the Immobilization Command 

      The Set Output command is commonly used with devices such as the Hawk Datalogger - for example to remotely turn on or off a water pump.  

      Payload:

      Data structure for to set digital outputs.

      Offset

      Length

      Data Type

      Description

      0

      2

      UINT16

      Logical level
      b0 – output 0 logical level: On = 1; Off = 0 
      b1 – output 1 logical level: On = 1; Off = 0
      b2 – etc.

      2

      2

      UINT16

      Change mask
      b0 – set output 0 according to logical level
      b1 – set output 1 according to logical level

      If we would like to turn on Digital Outputs 1 and 2, 

      We require, 

      • Logical Level - 0000 0110 (outputs 1 and 2 logical level 1) 
      • Change Mask - 1111 1111 = 0xFFFF - allow all inputs to be changed. In general we typically will always set these 2 bytes to 0xFFFF

      Therefore the data to send is:

      FF FF 00 06.

      Sending this as a JSON array gives [15, 15, 6, 0] (note byte ordering)

      cURL Example:

      curl -X 'POST' \ 'https://api.oemserver.com/v1/AsyncMessaging/Send?serial=439705' \ -H 'accept: text/plain' \ -H 'Authorization: Basic bWF0dGNAZGlnaXRhbG1hdHRlci5jb206dnMyaDZxWVQ3eDJM' \ -H 'Content-Type: application/json' \ -d '{ "MessageType": 4, "CANAddress": 4294967295, "ExpiryDateUTC": "2025-03-28T13:27:05.246Z", "SendAfterDateUTC": "2025-03-26T13:27:05.246Z", "Flags": 0, "Data": [15,15,6,0] }'

      curl -X 'POST' \
        'https://api.oemserver.com/v1/AsyncMessaging/Send?serial=439705' \
        -H 'accept: text/plain' \
        -H 'Authorization: Basic XXXXXXXXXXXXXXXXXXXXX' \
        -H 'Content-Type: application/json' \
        -d '{
        "MessageType": 4,
        "CANAddress": 4294967295,
        "ExpiryDateUTC": "2025-03-28T13:27:05.246Z",
        "SendAfterDateUTC": "2025-03-26T13:27:05.246Z",
        "Flags": 0,
        "Data": [15,15,6,0]
      }'

      Response

      Device Manager responds 200 OK with the Message ID (a someone arbitrary number assigned by Device Manager to Async messages)

      Within Device Manager, we can view the Async Message history or queue on the Device View.

      We can see in the details, Output 1, and Output 2 have been set to ‘High’ (1, on).

      So our command has worked. 

      Confirming the device has actioned the change

      We can keep track as to whether our change has been applied and the state of our outputs in a few places:

      1. Field ID 2 – Digital Data

      We simply look at the status of the relevant output(s)

      1. Digital Output Changed Log Reason

      These logs are not enabled by default, but this can be adjusted in the parameters

      If enabled, a log with Log Reason 10 - Digital Output Changed Log Reason will be generated on a change. 

      request endpoint

      Was this article helpful?

      Yes
      No
      Give feedback about this article

      Related Articles

      • Controlling Digital Outputs from Telematics Guru

      Subscribe to Partner News

      Subscribe to our mailing list to receive Digital Matter news, product and tehnical updates, and more.

      Subscribe

      Copyright © Digital Matter . All Rights Reserved.

      Privacy Contact Support

      Knowledge Base Software powered by Helpjuice

      DM Logo
      Expand