CRBasic Program DownloadΒΆ

Command the data logger to download a CRBasic Program via HTTP GET from a URL. If successful, the program will be compiled, and set as run on power up.

Topic Structure: <baseTopic>/cc/<deviceID>/program

Properties

  • "url": {string} Full path and file name of the program on the server.

  • "fileName": {string} Desired name of the program on the data logger. This can be a new name or the same name on the server.

  • "tranID": (optional)

Example command:

Subscribe cs/v2/cc/ABCD-EFGH-1234/program

{
    "url": "https://DataThings.com/Documents/CRBasic/Data0xB6.crb",
    "fileName":"Data0xB6.crb",
    "tranID": "0668a496-568d-4b04-8cdf-7b139eb5fc3f"
}

Progress

Progress of the program download will be published on the state topic.

Publish cs/v2/state/ABCD-EFGH-1234

  • Download Started

{
    "clientId": "ABCD-EFGH-1234",
    "state": "online",
    "fileTransfer": "Program file download"
}
  • Loading Program

{
    "clientId": "ABCD-EFGH-1234",
    "state": "offline",
    "reason": "Loading program"
}

Note

The data logger is attempting to compile the program during this phase. Communications will remain offline until compilation is complete.

  • Complete

{
    "clientId": "ABCD-EFGH-1234",
    "state": "online"
}

Response

Publish cs/v2/cr/ABCD-EFGH-1234/program/0668a496-568d-4b04-8cdf-7b139eb5fc3f

In addition to the State topic messages, the data logger will publish a final result of the program download on the cr topic.

{
    "success": "Program loaded successfully"
}

Error Responses

  • {"error": "Program download failed"}

  • {"error": "JSON missing program URL"}

  • {"error": "JSON missing file name"}