Alarm Data Transmission Protocol

This document describes how alarm terminals transmit data to the server using two methods.

๐Ÿ“Œ Overview

Both support sending alarm metadata and a JPEG image.

โœ… Alarm Data Format (Common JSON)

{
  "type": "carehome",
  "camIP": "192.168.1.88",
  "curTime": "2025-06-18T16:25:00",
  "stats": {
    "emergency": 1,
    "alert": 1
  },
  "image": "base64-encoded-image-data"
}
FieldTypeDescription
typestringFixed value: "carehome"
camIPstringCamera IP address
curTimestringAlarm trigger time formatted in ISO 8601 standard
statsobjectStatus indicators, including emergency, alert, notice
imagestring (Base64)Encoded JPEG image

Details of the stats field:

๐Ÿ”— Protocol 1: TCP + JSON

Data format:

#lonrock-carehome#{JSON_CONTENT}$$

Example:

#lonrock-carehome#{
  "type": "carehome",
  "camIP": "192.168.1.88",
  "curTime": "2025-06-18T16:25:00",
  "stats": {"emergency":1},
  "image": "/9j/4AAQSkZJRgABAQAAAQABAAD..."
}$$

๐ŸŒ Protocol 2: HTTP POST

Form fields:

FieldTypeDescription
contenttextJSON alarm info (without image Data)
imagefileJPEG image file

Example of content:

{
  "type": "carehome",
  "camIP": "192.168.1.88",
  "curTime": "2025-06-18T16:25:00",
  "stats": {
    "alert": 1
  }
}

Example of image: Upload a JPEG file, such as alarm.jpg

๐Ÿงช Server Implementation Notes

For TCP + JSON:

For HTTP POST:

๐Ÿ“Ž Notes & Recommendations