Skip to main content

Custom Flight Area

Current support

Custom flight areas currently support only the M400 and M4 aircraft models. No-landing zones are not currently supported.

  1. The custom flight area file must be named as follows: geofence_{fileMD5}.json, where fileMD5 is a placeholder for the MD5 value of the file.
  2. Click to download the custom flight area template file: Custom Flight Area File Template

Event

Sync state of custom flight area files​

The progress of synchronizing custom flight area files from the cloud to the device side, used to subsequently delimit the flight area of the aircraft.

Topic: thing/product/{gateway_sn}/events

Direction: up

Method: flight_areas_sync_progress

Data:

ColumnNameTypeconstraintDescription
statusSynchronization stateenum_string{"fail":"Failed","switch_fail":"Enable switch failed","synchronized":"Synchronized","synchronizing":"Synchronizing","wait_sync":"To be synchronized"}
reasonReturn codeint{"1":"Failed to parse file information returned from the cloud","2":"Failed to get file information on the aircraft side","3":"Failed to download file from the cloud","4":"Link flip failed","5":"File transfer failed","6":"Disable failed","7":"Failed to delete custom flight area","8":"Failed to load job area data on the aircraft side","9":"Enable failed","10":"Dock enhanced image transmission cannot be turned off, job area data synchronization failed","11":"Aircraft startup failed, unable to synchronize job area data","12":"Checksum verification failed","13":"Synchronization exception timeout"}
fileCustom flight area filestruct
»nameCustom flight area file nametext
»checksumFile signature digesttext{}File SHA256 signature

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"file": {
"checksum": "sha256",
"name": "geofence_xxx.json"
},
"reason": 0,
"status": "synchronized"
},
"method": "flight_areas_sync_progress",
"need_reply": 1,
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 16540709686556
}

Custom flight area alarm information push​

Topic: thing/product/{gateway_sn}/events

Direction: up

Method: flight_areas_drone_location

Data:

ColumnNameTypeconstraintDescription
drone_locationsAircraft custom flight area distance informationstruct
»area_idUnique ID of the areastring
»area_distanceDistance to flight boundaryfloat
»is_in_areaWhether in the custom flight areabool

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"drone_locations": [
{
"area_distance": 100.11,
"area_id": "d275c4e1-d864-4736-8b5d-5f5882ee9bdd",
"is_in_area": true
}
]
},
"method": "flight_areas_drone_location",
"need_reply": 0,
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 16540709686556
}

Service

Custom flight area update command​

Topic: thing/product/{gateway_sn}/services

Direction: down

Method: flight_areas_update

Data: null

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": null,
"method": "flight_areas_update",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655
}

Topic: thing/product/{gateway_sn}/services_reply

Direction: up

Method: flight_areas_update

Data:

ColumnNameTypeconstraintDescription
resultReturn codeintNon-zero represents an error

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"method": "flight_areas_update",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655
}

Requests

Retrieve custom flight area files​

Topic: thing/product/{gateway_sn}/requests

Direction: up

Method: flight_areas_get

Data: null

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": null,
"method": "flight_areas_get",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655
}

Topic: thing/product/{gateway_sn}/requests_reply

Direction: down

Method: flight_areas_get

Data:

ColumnNameTypeconstraintDescription
resultReturn codeintNon-zero represents an error
outputOutputstruct
»filesCustom flight area file listarray{"size": -, "item_type": struct}Empty array if there is no custom flight area
»»nameFile nametext{}
»»urlFile URLtext{}
»»checksumFile signature digesttext{}File SHA256 signature
»»sizeFile sizeint{}

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"output": {
"files": [
{
"checksum": "sha256",
"name": "geofence_xxx.json",
"size": 500,
"url": "https://xx.oss-cn-hangzhou.aliyuncs.com/xx.json?Expires=xx&OSSAccessKeyId=xxx&Signature=xxx"
}
]
},
"result": 0
},
"method": "flight_areas_get",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655
}