Functional Services

Neuron would provide a series of API services for IIoT platform, to query the basic information, to control gateway behaviors or to setup the polling configuration. IIoT platform must initiate the communication by sending request message to Neuron. By return, Neuron would send back the required information or execute the deserved action. If there is error, a error code would be returned to tell the reason of failure.

MQTT Topics for Neuron

Subscribe: Neuron/Request /%UUID%

Publish: Neuro/Response n/%UUID%

MQTT Topics for IIoT platform

Subscribe: Neuron/Response /%UUID%

Publish: Neuron/Request /%UUID%

Functional Services - 图1

Functional Services - 图2

Function 10 Login

Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":10,
  3. "wtrm":"DEMO-Neuron-1001_1532421778824_1",
  4. "name":"admin",
  5. "pass":"0000"
  6. }

Response body syntax

  1. {
  2. "func": 10,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0,
  5. "tout": 15,
  6. "defl": -1,
  7. "nalw": 3,
  8. "alwl": [{
  9. "atxt": "VIEW",
  10. "anum": 0
  11. },
  12. {
  13. "atxt": "MANAGER",
  14. "anum": 1
  15. },
  16. {
  17. "atxt": "ALL",
  18. "anum": -1
  19. }]
  20. }
Request
func Function code 10
wtrm A water mark that copied to the response message
name Username
pass User password
Response
func Function code 10
wtrm A water mark that copied from the request message
errc Compiler error code
tout Time out
defl Default level
nalw No of allowed levels
alwl Allowed level
atxt Allowed text ALL -1
VIEW 0
OPERATOR 1
FOREMAN 2
MAINTENANCE 3
SUPERVISOR 4
ENGINEER 5
DESIGNER 6
MANAGER 7
anum Allowed number -1
0
1
2
3
4
5
6
7
Functions Allowed Level
Exit to shell 4,5,7
Restart/Newrestart/Shutdown 2,3,4,5,6,7
Login/Logout 0,1,2,3,4,5,6,7
New password 0,1,2,3,4,5,6,7
User administration 4,5,7
Browse system ID 4,5,7
Status control 2,3,4,5,7
Write value to object 4,5,7
Read instance list 4,5,7
Setup configuration 4,5,7
Read configuration 4,5,7
Read global variable 4,5,7
List all subroutine 4,5,7
Read a subroutine 4,5,7
Create a subroutine 4,5,7
Delete a subroutine 4,5,7
Compiler a subroutine 4,5,7
Search string in a subroutine 4,5,7
Check alarm status 1,2,3,4,5,7
Alarm acknowledge 2,3,4,5,7
Change alarm mode 2,3,4,5,7
Alarm Log report 4,5,7
Read trend data 2,3,4,5,7
Read object screen 2,3,4,5,7
Read License Information 4,5,7

Function 11 Logout

Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":11,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "name":"admin"
  5. }

Request body syntax

  1. {
  2. "func":11,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "errc":0
  5. }
Request
func Function code 11
wtrm A water mark that copied to the response message
name Username
Response
func Function code 11
wtrm A water mark that copied from the request message
errc Compiler error code

Function 12 New Password

HTTP API Header

(POST)

Resource Path: /api/v1/funcno12

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":12,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "name":"admin",
  5. "pass":"0000",
  6. "npwd":"1234"
  7. }

Request body syntax

  1. {
  2. "func":12,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "errc":0
  5. }
Request
func Function code 12
wtrm A water mark that copied to the response message
name Username
pass Password
npwd New Password
Response
func Function code 12
wtrm A water mark that copied from the request message
errc Compiler error code

Function 13 Read User List

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno13

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":13,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240"
  4. }

Request body syntax

  1. {
  2. "func":13,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "errc":0,
  5. "nusr": 3,
  6. "user": ["joey",
  7. "peter",
  8. "ruby" ]
  9. }
Request
func Function code 13
wtrm A water mark that copied to the response message
Response
func Function code 13
wtrm A water mark that copied from the request message
errc Compiler error code

nusr No of users user A list of users name

Function 14 Read User Information

HTTP API header

(PUT)

Resource Path: /api/v1/funcno14

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":14,
  3. "wtrm":"DEMO-Neuron-1001_1532421778824_1",
  4. "name":"joey"
  5. }

Request body syntax

  1. {
  2. "func": 14,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0,
  5. "usrn": "joey"
  6. "tout": 15,
  7. "defl": -1,
  8. "nalw": 3,
  9. "alwl": [{
  10. "atxt": "VIEW",
  11. "anum": 0
  12. },
  13. {
  14. "atxt": "MANAGER",
  15. "anum": 1
  16. },
  17. {
  18. "atxt": "ALL",
  19. "anum": -1
  20. }]
  21. }
Request
func Function code 14
wtrm A water mark that copied to the response message
name Username
Response
func Function code 14
wtrm A water mark that copied from the request message
errc Compiler error code
usrn User name
tout Time out
defl Default level
nalw No of allowed levels
alwl Allowed level
atxt Allowed text ALL
VIEW
OPERATOR
FOREMAN
MAINTENANCE
SUPERVISOR
ENGINEER
DESIGNER
MANAGER
anum Allowed number -1
0
1
2
3
4
5
6
7

Function 15 Save User Information

HTTP API Header

(POST)

Resource Path: /api/v1/funcno15

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":15,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "cusr": 1,
  5. "name": "joey",
  6. "pass": "0000",
  7. "tout": 15,
  8. "defl": 7,
  9. "nalw": 3,
  10. "alwl": [0,6,7]
  11. }

Request body syntax

  1. {
  2. "func":15,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "errc":0
  5. }
Request
func Function code 15
wtrm A water mark that copied to the response message
cusr Check user already exist if exist, return error
name User name
pass New password
tout Timeout (0-999 in minutes, 0 means never time-out)
defl Default level (0-9)
nalw No of allowed level
alwl Array of allowed level
Response
func Function code 15
wtrm A water mark that copied from the request message
errc Compiler error code

Function 16 Remove User

HTTP API Header

(DELETE)

Resource Path: /api/v1/funcno16

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":16,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "name":"user"
  5. }

Request body syntax

  1. {
  2. "func":16,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "errc":0
  5. }
Request
func Function code 16
wtrm A water mark that copied to the response message
name Username
Response
func Function code 16
wtrm A water mark that copied from the request message
errc Compiler error code

Function 21 Configuration

HTTP API Header

(POST)

Resource Path: /api/v1/funcno21

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request boy syntax

  1. {
  2. "func": 21,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "chnl": [{
  5. "chdv": "mbstcp",
  6. "tcph": "192.168.1.119",
  7. "tcpp": 502,
  8. "ttyc": "",
  9. "ttyb": 0,
  10. "ttyd": 0,
  11. "ttys": "",
  12. "ttyp": "N",
  13. "parm": [{
  14. "vars": "DLYCRESOCKAFTCLOSE",
  15. "pars": "300"
  16. }, {
  17. "vars": "TORECEIVETCP",
  18. "pars": "300"
  19. }, {
  20. "vars": "NAPTIMEREAD",
  21. "pars": "40"
  22. }, {
  23. "vars": "NAPTIMEWRITE",
  24. "pars": "20"
  25. }]
  26. },{
  27. "chdv": "pahomq",
  28. "tcph": "broker.emqx.io",
  29. "tcpp": 1883,
  30. "ttyc": "",
  31. "ttyb": 0,
  32. "ttyd": 0,
  33. "ttys": "",
  34. "ttyp": "N",
  35. "parm": [{
  36. "vars": "USERNAME",
  37. "pars": ""
  38. }, {
  39. "vars": "PASSWORD",
  40. "pars": ""
  41. }, {
  42. "vars": "CERTIFICATE",
  43. "pars": ""
  44. }, {
  45. "vars": "KEYFILE",
  46. "pars": ""
  47. }]
  48. }],
  49. "objd": [{
  50. "objn": "Tank",
  51. "obsz": 3,
  52. "updt": 1,
  53. "logt": 1,
  54. "disp": 1,
  55. "logs": 0,
  56. "tstd": 0,
  57. "oatt": [{
  58. "attn": "temperature",
  59. "attt": "word",
  60. "deci": 1,
  61. "attr": "R",
  62. "rtim": 0,
  63. "achg": 1,
  64. "adis": 1,
  65. "aadd": [{
  66. "obix": 0,
  67. "pref": "",
  68. "suff": "1",
  69. "addr": "1!4!40200"
  70. },
  71. {
  72. "obix": 1,
  73. "pref": "",
  74. "suff": "2",
  75. "addr": "1!4!40201"
  76. },
  77. {
  78. "obix": 2,
  79. "pref": "",
  80. "suff": "3",
  81. "addr": "1!4!40202"
  82. }]
  83. },
  84. {
  85. "attn": "energy",
  86. "attt": "word",
  87. "deci": 1,
  88. "attr": "R",
  89. "rtim": 0,
  90. "achg": 1,
  91. "adis": 1,
  92. "aadd": [{
  93. "obix": 0,
  94. "pref": "",
  95. "suff": "1",
  96. "addr": "1!1!40100"
  97. },
  98. {
  99. "obix": 1,
  100. "pref": "",
  101. "suff": "2",
  102. "addr": "1!2!40100"
  103. },
  104. {
  105. "obix": 2,
  106. "pref": "",
  107. "suff": "3",
  108. "addr": "1!3!40100"
  109. }]
  110. },
  111. {
  112. "attn": "switch",
  113. "attt": "bit",
  114. "deci": 0,
  115. "attr": "RW",
  116. "rtim": 0,
  117. "achg": 1,
  118. "adis": 1,
  119. "aadd": [{
  120. "obix": 0,
  121. "pref": "",
  122. "suff": "1",
  123. "addr": "1!5!00100"
  124. },
  125. {
  126. "obix": 1,
  127. "pref": "",
  128. "suff": "2",
  129. "addr": "1!5!00102"
  130. },
  131. {
  132. "obix": 2,
  133. "pref": "",
  134. "suff": "3",
  135. "addr": "1!5!00104"
  136. }]
  137. },
  138. {
  139. "attn": "buzzer",
  140. "attt": "bit",
  141. "deci": 0,
  142. "attr": "RW",
  143. "rtim": 0,
  144. "achg": 1,
  145. "adis": 1,
  146. "aadd": [{
  147. "obix": 0,
  148. "pref": "",
  149. "suff": "1",
  150. "addr": "1!5!00101"
  151. },
  152. {
  153. "obix": 1,
  154. "pref": "",
  155. "suff": "2",
  156. "addr": "1!5!00103"
  157. },
  158. {
  159. "obix": 2,
  160. "pref": "",
  161. "suff": "3",
  162. "addr": "1!5!00105"
  163. }]
  164. }]
  165. },
  166. {
  167. "objn": "Temp",
  168. "obsz": 1,
  169. "updt": 1,
  170. "logt": 1,
  171. "disp": 1,
  172. "logs": 1,
  173. "tstd": 0,
  174. "oatt": [{
  175. "attn": "high",
  176. "attt": "word",
  177. "deci": 1,
  178. "attr": "-",
  179. "rtim": 0,
  180. "achg": 1,
  181. "adis": 1,
  182. "aadd": [{
  183. "obix": 0,
  184. "pref": "",
  185. "suff": "",
  186. "addr": "-"
  187. }]
  188. },
  189. {
  190. "attn": "temp1",
  191. "attt": "word",
  192. "deci": 1,
  193. "attr": "R",
  194. "rtim": 0,
  195. "achg": 1,
  196. "adis": 1,
  197. "aadd": [{
  198. "obix": 0,
  199. "pref": "",
  200. "suff": "",
  201. "addr": "1!4!40200"
  202. }]
  203. },
  204. {
  205. "attn": "temp2",
  206. "attt": "word",
  207. "deci": 1,
  208. "attr": "R",
  209. "rtim": 0,
  210. "achg": 1,
  211. "adis": 1,
  212. "aadd": [{
  213. "obix": 0,
  214. "pref": "",
  215. "suff": "",
  216. "addr": "1!4!40201"
  217. }]
  218. },
  219. {
  220. "attn": "temp3",
  221. "attt": "word",
  222. "deci": 1,
  223. "attr": "R",
  224. "rtim": 0,
  225. "achg": 1,
  226. "adis": 1,
  227. "aadd": [{
  228. "obix": 0,
  229. "pref": "",
  230. "suff": "",
  231. "addr": "1!4!40202"
  232. }]
  233. },
  234. {
  235. "attn": "low",
  236. "attt": "word",
  237. "deci": 1,
  238. "attr": "-",
  239. "rtim": 0,
  240. "achg": 1,
  241. "adis": 1,
  242. "aadd": [{
  243. "obix": 0,
  244. "pref": "",
  245. "suff": "",
  246. "addr": "-"
  247. }]
  248. }]
  249. },
  250. {
  251. "objn": "Energy",
  252. "obsz": 1,
  253. "updt": 1,
  254. "logt": 1,
  255. "disp": 1,
  256. "logs": 1,
  257. "tstd": 0,
  258. "oatt": [{
  259. "attn": "energy1",
  260. "attt": "word",
  261. "deci": 1,
  262. "attr": "R",
  263. "rtim": 0,
  264. "achg": 1,
  265. "adis": 1,
  266. "aadd": [{
  267. "obix": 0,
  268. "pref": "",
  269. "suff": "",
  270. "addr": "1!1!40100"
  271. }]
  272. },
  273. {
  274. "attn": "energy2",
  275. "attt": "word",
  276. "deci": 1,
  277. "attr": "R",
  278. "rtim": 0,
  279. "achg": 1,
  280. "adis": 1,
  281. "aadd": [{
  282. "obix": 0,
  283. "pref": "",
  284. "suff": "",
  285. "addr": "1!2!40100"
  286. }]
  287. },
  288. {
  289. "attn": "energy3",
  290. "attt": "word",
  291. "deci": 1,
  292. "attr": "R",
  293. "rtim": 0,
  294. "achg": 1,
  295. "adis": 1,
  296. "aadd": [{
  297. "obix": 0,
  298. "pref": "",
  299. "suff": "",
  300. "addr": "1!3!40100"
  301. }]
  302. }]
  303. }],
  304. "msgd": [{
  305. "msgt": ">",
  306. "sobj": "Temp",
  307. "satt": "temp1",
  308. "cobj": "Temp",
  309. "catt": "high",
  310. "acat": "critical",
  311. "subr": 200
  312. },
  313. {
  314. "msgt": "<",
  315. "sobj": "Temp",
  316. "satt": "temp1",
  317. "cobj": "Temp",
  318. "catt": "low",
  319. "acat": "alarm",
  320. "subr": 0
  321. },
  322. {
  323. "msgt": ">",
  324. "sobj": "Temp",
  325. "satt": "temp2",
  326. "cobj": "Temp",
  327. "catt": "high",
  328. "acat": "critical",
  329. "subr": 201
  330. },
  331. {
  332. "msgt": "<",
  333. "sobj": "Temp",
  334. "satt": "temp2",
  335. "cobj": "Temp",
  336. "catt": "low",
  337. "acat": "alarm",
  338. "subr": 0
  339. },
  340. {
  341. "msgt": ">",
  342. "sobj": "Temp",
  343. "satt": "temp3",
  344. "cobj": "Temp",
  345. "catt": "high",
  346. "acat": "critical",
  347. "subr": 202
  348. },
  349. {
  350. "msgt": "<",
  351. "sobj": "Temp",
  352. "satt": "temp3",
  353. "cobj": "Temp",
  354. "catt": "low",
  355. "acat": "alarm",
  356. "subr": 0
  357. }]
  358. }

Request body syntax

  1. {
  2. "func": 21,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0
  5. }
Request
func Function code 21
wtrm A water mark that copied to the response message
chnl Channel Details
chdv Channel driver name
tcph Hostname or IP address of PLC/hardware device
tcpp Port number of a device
ttyc Linux device file name (ttyS0, ttyS1)
ttyb Baud rate
4800
9600
19200
38400
57600
115200
ttyd Data bit
5
6
7
8
ttys Stop bit (string)
1
1.5
2
ttyp Parity bit (char)
E - Even
O - Odd
N - None
parm Parameter array Details
vars Variables name
pars Parameters
objd Object Details
objn Object name
obsz Number of same objects
updt Time interval for data transfer to platform cloud
logt Time interval for data to be logged on file
tstd Timestamp display
0 (no display)
1 (display)
disp All object attributes need to be displayed
0 (no display)
1 (display)
logs Need logging once connection drop
0 (no need)
1 (need)
oatt Object Attribute Details
attn Attribute name
attt Attribute value type:
word
uword
dword
udword
float
double
bit
datetime
deci No of decimal place
adis Attribute transferred to platform
0 (no need)
1 (need)
achg Attribute can be changed
0 (not allow)
1 (allow)
attr Attribute Read/Write indicator
R
W
R/W
rtim Read time (for only attr: R)
aadd Attribute Address Details
obix Start from 0 index number
pref Object name prefix
suff Object name suffix
addr Tag address (device address)
Note: For internal register, both tagaddr and tagattr use “-“
msgd Message Details
msgt Message type
<
<=
>
>=
==
!=
&
\^
\
sobj Source object name
satt Source attribute name
cobj Compared object name
catt Compared attribute name
acat Alarm Category
critical
alarm
warning
event
view
subr Subroutine number (1-999)
Response
func Function code 21
wtrm A water mark that copied from the request message
errc Compiler error code

Function 22 Read Configuration

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno22

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":22,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240"
  4. }

Request body syntax

  1. {
  2. "func":22,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "errc":0,
  5. The structure is same as Function 21 request message
  6. **** Not repeat here ****
  7. }

Function 23 Read Drivers

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno23

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":23,
  3. "wtrm":"DEMO-Neuron-1001_1532421778824_1"
  4. }

Request body syntax

  1. {
  2. "func": 23,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0,
  5. "nrow": 3,
  6. "rows": [{
  7. "name": "mbsrtu",
  8. "desc": "Modbus RTU",
  9. "type": "tty"
  10. },
  11. {
  12. "name": "mbstcp",
  13. "desc": "Modbus TCP",
  14. "type": "tcp"
  15. },
  16. {
  17. "name": "mbsrot",
  18. "desc": "Modbus RTU over TCP",
  19. "type": "tcp"
  20. }]
  21. }
Request
func Function code 23
wtrm A water mark that copied to the response message
Response
func Function code 23
wtrm A water mark that copied from the request message
errc Compiler error code
nrow Number of rows
name Short name of driver
desc Full description of driver
type Type of driver
tty Serial driver
tcp Network driver

Function 24 Read Driver Parameters

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno24

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":23,
  3. "wtrm":"DEMO-Neuron-1001_1532421778824_1",
  4. "drvn":"i61850"
  5. }

Request body syntax

  1. {
  2. "func": 24,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0,
  5. "drvn": "i61850",
  6. "parm": [{
  7. "vars": "DLYCRESOCKAFTCLOSE",
  8. "pars": "300"
  9. },
  10. {
  11. "vars": "TORECEIVETCP",
  12. "pars": "300"
  13. },
  14. {
  15. "vars": "NAPTIMEREAD",
  16. "pars": "40"
  17. },
  18. {
  19. "vars": "NAPTIMEWRITE",
  20. "pars": "20"
  21. },
  22. {
  23. "vars": "USERNAME",
  24. "pars": ""
  25. },
  26. {
  27. "vars": "PASSWORD",
  28. "pars": ""
  29. },
  30. {
  31. "vars": "CERTIFICATE",
  32. "pars": ""
  33. },
  34. {
  35. "vars": "KEYFILE",
  36. "pars": ""
  37. },
  38. {
  39. "vars": "ADDRSUFFIX",
  40. "pars": ""
  41. }]
  42. }

Function 25 Check PLC Addresses

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno25

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 25,
  3. "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  4. "chdv": "mbtcp",
  5. "attt": "word",
  6. "deci": 0,
  7. "attr": "R",
  8. "addr": "1!400002"
  9. }

Request body syntax

  1. {
  2. "func": 25,
  3. "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  4. "errc": 0
  5. }
Request
func Function code 25
wtrm A water mark that copied from the request message
chdv Channel driver name
attt Attribute value type, allow text:
word
uword
dword
udword
float
double
bit
datetime
deci No of decimal place
attr Attribute Read/Write indicator, allow text:
R
W
R/W
addr Tag address (device address)
Note: For internal register, both tagaddr and tagattr use “-“
Response
func Function code 25
wtrm A water mark that copied from the request message
errc Compiler error code

Function 30 Read Global Variable

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno30

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":30,
  3. "wtrm":"DEMO-Neuron-1001_1532421778824_1"
  4. }

Request body syntax

  1. {
  2. "func": 30,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0,
  5. "nrow": 7,
  6. "rows": [{
  7. "glov": "time",
  8. "leng": 1,
  9. "comt": "unix timestamp"
  10. },
  11. {
  12. "glov": "year",
  13. "leng": 1,
  14. "comt": "current year"
  15. },
  16. {
  17. "glov": "month",
  18. "leng": 1,
  19. "comt": "current month"
  20. },
  21. {
  22. "glov": "day",
  23. "leng": 1,
  24. "comt": "day of the month"
  25. },
  26. {
  27. "glov": "hour",
  28. "leng": 1,
  29. "comt": "hour of the day"
  30. },
  31. {
  32. "glov": "min",
  33. "leng": 1,
  34. "comt": "minute of the hour"
  35. },
  36. {
  37. "glov": "dayofweek",
  38. "leng": 1,
  39. "comt": "day of the week"
  40. }]
  41. }
Request
func Function code 30
wtrm A water mark that copied to the response message
Response
func Function code 30
wtrm A water mark that copied from the request message
errc Compiler error code

nrow Number of rows glov Global variable name leng Variable size comt Comments

Function 31 Save Global Variable

HTTP API Header

(POST)

Resource Path: /api/v1/funcno31

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 31,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "nrow": 7,
  5. "rows": [{
  6. "glov": "time",
  7. "leng": 1,
  8. "comt": "unix timestamp"
  9. },
  10. {
  11. "glov": "year",
  12. "leng": 1,
  13. "comt": "current year"
  14. },
  15. {
  16. "glov": "month",
  17. "leng": 1,
  18. "comt": "current month"
  19. },
  20. {
  21. "glov": "day",
  22. "leng": 1,
  23. "comt": "day of the month"
  24. },
  25. {
  26. "glov": "hour",
  27. "leng": 1,
  28. "comt": "hour of the day"
  29. },
  30. {
  31. "glov": "min",
  32. "leng": 1,
  33. "comt": "minute of the hour"
  34. },
  35. {
  36. "glov": "dayofweek",
  37. "leng": 1,
  38. "comt": "day of the week"
  39. }]
  40. }

Request body syntax

  1. {
  2. "func": 31,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0
  5. }
Request
func Function code 31
wtrm A water mark that copied to the response message

nrow Number of rows glov Global variable name leng Variable size comt Comments

Response
func Function code 31
wtrm A water mark that copied from the request message
errc Compiler error code

Function 32 Read Subroutine List

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno32

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":32,
  3. "wtrm":"DEMO-Neuron-1001_1532421778823_1"
  4. }

Request body syntax

  1. {
  2. "func": 32,
  3. "wtrm": "DEMO-Neuron-1001_1532421778823_1",
  4. "errc": 0,
  5. "nsub": 3,
  6. "msub": 999,
  7. "rows": [{
  8. "subr": 200,
  9. "name": "SR200 TEMPERATURE ALARM HANDLER"
  10. },
  11. {
  12. "subr": 201,
  13. "name": "SR201 TEMPERATURE ALARM HANDLER"
  14. },
  15. {
  16. "subr": 202,
  17. "name": "SR202 TEMPERATURE ALARM HANDLER"
  18. }]
  19. }
Request
func Function code 32
wtrm A water mark that copied to the response message
Response
func Function code 32
wtrm A water mark that copied from the request message
errc Compiler error code

nsub Number of subroutines msub Maximum number of subroutines subr Subroutine number |name |Subroutine name

Function 33 Read Subroutine

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno33

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":33,
  3. "wtrm":"DEMO-Neuron-1001_1532421778827_1",
  4. "subr": 200
  5. }

Request body syntax

  1. {
  2. "func": 33,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "subr": 200,
  6. "name": "SR200 TEMPERATURE ALARM TIRGGER HANDLER",
  7. "nrow": 5,
  8. "rows": [{
  9. "stmt": "COMMENT",
  10. "expr": "TEMPERATURE HANDLER"
  11. },
  12. {
  13. "stmt": "",
  14. "expr": ""
  15. },
  16. {
  17. "stmt": "IF",
  18. "expr": "Tank[0].buzzer == 0"
  19. },
  20. {
  21. "stmt": "THEN",
  22. "expr": "Tank[0].buzzer = 1;"
  23. },
  24. {
  25. "stmt": "",
  26. "expr": ""
  27. }]
  28. }
Request
func Function code 33
wtrm A water mark that copied to the response message
subr Subroutine number
Response
func Function code 33
wtrm A water mark that copied from the request message
errc Compiler error code
subr Subroutine number
MAIN is -10
MANUAL is -20
AUTO is -22
name Subroutine name
nrow Number of rows
stmt Statement
expr Expression

Function 34 Save Subroutine

HTTP API Header

(POST)

Resource Path: /api/v1/funcno34

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 34,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "csub": 0,
  5. "subr": 200,
  6. "name": "SR200 TEMPERATURE ALARM TIRGGER HANDLER",
  7. "nrow": 5,
  8. "rows": [{
  9. "stmt": "COMMENT",
  10. "expr": "TEMPERATURE HANDLER"
  11. },
  12. {
  13. "stmt": "",
  14. "expr": ""
  15. },
  16. {
  17. "stmt": "IF",
  18. "expr": "Tank[0].buzzer == 0"
  19. },
  20. {
  21. "stmt": "THEN",
  22. "expr": "Tank[0].buzzer = 1;"
  23. },
  24. {
  25. "stmt": "",
  26. "expr": ""
  27. }]
  28. }

Request body syntax

  1. {
  2. "func": 34,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0
  5. }
Request
func Function code 34
wtrm A string that copied to the response message
csub Check Subroutine Exist before save (0 — don’t check, 1
— check)
subr Routine Number
MAIN is -10
MANUAL is -20
AUTO is -22
Or any number (1-999) for subroutine
name Subroutine Name
line No of Lines
stmt Statement
expr Expression
Response
func Function code 34
wtrm A water mark that copied from the request message
errc Compiler error code

Function 35 Remove Subroutine

HTTP API Header

(DELETE)

Resource Path: /api/v1/funcno35

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":35,
  3. "wtrm":"DEMO-Neuron-1001_1532421778827_1",
  4. "subr": 200
  5. }

Request body syntax

  1. {
  2. "func": 35,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0
  5. }
Request
func Function code 35
wtrm A water mark that copied to the response message
subr Subroutine Number
Response
func Function code 35
wtrm A water mark that copied from the request message
errc Compiler error code

Function 36 Test Subroutine

HTTP API Header

(POST)

Resource Path: /api/v1/funcno36

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 36,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "nrow": 5,
  5. "rows": [{
  6. "stmt": "COMMENT",
  7. "expr": "TEMPERATURE HANDLER"
  8. },
  9. {
  10. "stmt": "",
  11. "expr": ""
  12. },
  13. {
  14. "stmt": "IF",
  15. "expr": "Tank[0].buzzer == 0"
  16. },
  17. {
  18. "stmt": "THEN",
  19. "expr": "Tank[0].buzzer = 1;"
  20. },
  21. {
  22. "stmt": "",
  23. "expr": ""
  24. }]
  25. }

Request body syntax

  1. {
  2. "func": 36,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0
  5. }
Request
func Function code 36
wtrm A water mark that copied to the response message
subr Subroutine Number
line No of Lines
stmt Statement
expr Expression
Response
func Function code 36
wtrm A water mark that copied from the request message
errc Compiler error code

Function 37 Search in Subroutine

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno37

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 37,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "srhm": "main",
  5. "upca": 0,
  6. "wwrd": 0,
  7. "srhs": "temperature"
  8. }

Request body syntax

  1. {
  2. "func": 37,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "rows": [{
  6. "modu": "main",
  7. "line": 1,
  8. "chnu": 8,
  9. "desc": "COMMENT MAIN - TEMPERATURE CONTROL"
  10. },
  11. {
  12. "modu": "main",
  13. "line": 7,
  14. "chnu": 9,
  15. "desc": "IF Tank[i].temperature > Temp[0].high &&
  16. Tank[i].switch == 1"
  17. },
  18. {
  19. "modu": "main",
  20. "line": 9,
  21. "chnu": 9,
  22. "desc": "ELSE IF Tank[i].temperature < Temp[0].low &&
  23. Tank[i].switch == 0"
  24. }]
  25. }
Request
func Function code 37
wtrm A water mark that copied to the response message
srhm Search mode globalvar
main
man
auto
subroutine
upca Match upper lower case (1 match, 0 no need)
wwrd Match whole word (1 match whole, 0 match part)
srhs Search string
Response
func Function code 37
wtrm A water mark that copied from the request message
errc Compiler error code
rows Row number index
modu Module globalvar
main
man
auto
subroutine
subr Subroutine number
line Line number
chnu Start at character position
desc Description

Function 38 Execute Script

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno38

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 38,
  3. "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  4. "subr": 200
  5. }

Request body syntax

  1. {
  2. "func": 38,
  3. "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  4. "errc": 0
  5. }
Request
func Function code 38
wtrm A water mark that copied from the request message

subr Subroutine number (1-999)

Response
func Function code 38
wtrm A water mark that copied from the request message
errc Compiler error code

Function 50 Read Register

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno50

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 50,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "srcn": "Tank_1"
  5. }

Request body syntax

  1. {
  2. "func": 50,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "tele": [{
  6. "objn": "Tank_1",
  7. "tstp": 1552532233,
  8. "temperature": 81.2,
  9. "energy": 2181.8,
  10. "switch": 1,
  11. "buzzer": 0
  12. },
  13. {
  14. "objn": "Tank_2",
  15. "tstp": 1552532233,
  16. "temperature": 79.1,
  17. "energy": 3176.2,
  18. "switch": 1,
  19. "buzzer": 0
  20. },
  21. {
  22. "objn": "Tank_3",
  23. "tstp": 1552532233,
  24. "temperature": 86.4,
  25. "energy": 1146.3,
  26. "switch": 0,
  27. "buzzer": 1
  28. }]
  29. }
Request
func Function code 50
wtrm A water mark that copied to the response message
Response
func Function code 50
wtrm A water mark that copied from the request message
errc Error code

tele Telemetry Array objn Object Name tstp TimeStamp

Function 51 Write Register

HTTP API Header

(POST)

Resource Path: /api/v1/funcno51

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 51,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "srcn": "Temp",
  5. "attn": "high",
  6. "valn": 860
  7. }

Request body syntax

  1. {
  2. "func": 51,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0
  5. }
Request
func Function code 51
wtrm A water mark that copied to the response message

srcn Object Name with prefix and suffix attn Attribute Name valn Value

Response
func Function code 51
wtrm A water mark that copied from the request message
errc Compiler error code

Function 60 Object Screen

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno60

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 60,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1"
  4. }

Request body syntax

  1. {
  2. "func": 60,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "tele": [{
  6. "objn": "Tank_1",
  7. "logs": 0,
  8. "temperature": 0,
  9. "energy": 0,
  10. "switch": 1,
  11. "buzzer": 1
  12. },
  13. {
  14. "objn": "Tank_2",
  15. "logs": 0,
  16. "temperature": 0,
  17. "energy": 0,
  18. "switch": 1,
  19. "buzzer": 1
  20. },
  21. {
  22. "objn": "Tank_3",
  23. "logs": 0,
  24. "temperature": 0,
  25. "energy": 0,
  26. "switch": 1,
  27. "buzzer": 1
  28. },
  29. {
  30. "objn": "Temp",
  31. "logs": 1,
  32. "high": 1,
  33. "temp1": 0,
  34. "temp2": 0,
  35. "temp3": 0,
  36. "low": 1
  37. },
  38. {
  39. "objn": "Energy",
  40. "logs": 1,
  41. "energy1": 0,
  42. "energy2": 0,
  43. "energy3": 0
  44. }]
  45. }
Request
func Function code 60
wtrm A water mark that copied to the response message
Response
func Function code 60
wtrm A water mark that copied from the request message
errc Error code

tele Telemetry object screen description objn Object name logs Logging (Y/N)

Function 61 System Status

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno61

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 61,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "actn": "act_en"
  5. }

Request body syntax

  1. {
  2. "func": 61,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "tstp": 1581515618,
  6. "comm": "UP",
  7. "mach": "MANU",
  8. "mode": "ACTIVE",
  9. "mqcn": "MQCONNECT",
  10. "dalm": "NON-EXIST",
  11. "galm": "UNACKNOWLEDGE",
  12. "ngal": 4,
  13. "grow": [{
  14. "acat": "alarm",
  15. "astt": "OFF",
  16. "amod": "UNACKALARM",
  17. "atim": 1581513580,
  18. "alid": 1,
  19. "comt": "temp1@Temp (812) < low@Temp (800)"
  20. },
  21. {
  22. "acat": "alarm",
  23. "astt": "ON",
  24. "amod": "UNACKALARM",
  25. "atim": 1581515415,
  26. "alid": 3,
  27. "comt": "temp2@Temp (791) < low@Temp (800)"
  28. },
  29. {
  30. "acat": "critical",
  31. "astt": "ON",
  32. "amod": "UNACKALARM",
  33. "atim": 1581515415,
  34. "alid": 4,
  35. "comt": "temp3@Temp (864) > high@Temp (850)"
  36. },
  37. {
  38. "acat": "alarm",
  39. "astt": "OFF",
  40. "amod": "UNACKALARM",
  41. "atim": 1581513592,
  42. "alid": 5,
  43. "comt": "temp3@Temp (864) < low@Temp (800)"
  44. }]
  45. }
Request
func Function code 61
wtrm A water mark that copied to the response message
actn Action can be anyone of following
act_en Active enabled alarms
act_unack Active Unack alarms
act_all Active all alarms
all_alm All alarms
all_en All enabled alarms
all_dis All disabled alarms
Response
func Function code 61
wtrm A water mark that copied from the request message
errc Error code
tstp TimeStamp
comm PLC or hardware communication status
UP
DOWN
mach Machine Mode
AUTO
MANU
SERV
mode Please refer to Status Mode section.
Inactive Mode
Standby Mode / Semi-Standby Mode
Active Mode / Semi-Active Mode
mqcn MQ broker connection status
MQCONNECT
MQDISCONNECT
dalm Device Alarm which specify which device has
communication problem.
ndal Number of device alarms
drow Device alarm rows
chnl Channel number of devices
addr Address of devices
galm General Alarm which user define their own alarms and
triggers
ngal Number of general alarms
grow General alarm rows
acat Alarm Category
critical
alarm
warning
event
view
astt Alarm Status
ON
OFF
amod Alarm Mode
UNACKALARM
DISABLE
atim Alarm TimeStamp
alid Alarm ID
must be copied this ID when user acknowledge function 80
comt Alarm Comments

Function 70 Gateway Control

HTTP API header

(POST)

Resource Path: /api/v1/funcno70

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":70,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "acts":"restartnew"
  5. }

Request body syntax

  1. {
  2. "func": 70,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0
  5. }
Request
func Function code 70
wtrm A water mark that copied to the response message
acts Request action
restart - restart gateway
restartnew - restart gateway with new configuration
shutdown - shutdown gateway
Response
func Function code 70
wtrm A water mark that copied from the request message
errc Compiler error code

Function 71 Status Control

HTTP API Header

(POST)

Resource Path: /api/v1/funcno71

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":71,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240",
  4. "stat":"standby"
  5. }

Request body syntax

  1. {
  2. "func": 71,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0
  5. }
Request
func Function code 71
wtrm A water mark that copied to the response message
stat Request action
standby - standby mode (telemetry will stop)
active - active mode
Response
func Function code 71
wtrm A water mark that copied from the request message
errc Compiler error code

Function 73 Instance Information

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno73

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func":73,
  3. "wtrm":"DEMO-Neuron-1001_1532419775357_240"
  4. }

Request body syntax

  1. {
  2. "func": 73,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0,
  5. "agts": [{
  6. "uuid": "16538d28-4592-11e9-a787-00e067109f12",
  7. "time": "2019/11/10 13:42:17",
  8. "expd": "2070/01/01 08:00:00",
  9. "rest": "00:00:00:00",
  10. "data": "2.113112",
  11. "natt": "34",
  12. "nalr": "10",
  13. "tatt": "50",
  14. "talr": "102",
  15. "tusg": "10.3426",
  16. "matt": "100",
  17. "malr": "500",
  18. "musg": "1000",
  19. "self": "Y",
  20. },
  21. {
  22. "uuid": "87244d28-4592-11e9-a787-00e097109f12",
  23. "time": "2019/11/10 13:42:17",
  24. "expd": "2070/01/01 08:00:00",
  25. "rest": "00:00:00:00",
  26. "data": "0.1276532",
  27. "natt": "19",
  28. "nalr": "13",
  29. "tatt": "50",
  30. "talr": "102",
  31. "tusg": "10.3426",
  32. "matt": "100",
  33. "malr": "500",
  34. "musg": "1000",
  35. "self": "N",
  36. },
  37. {
  38. "uuid": "11133d28-4592-11e9-a787-00e077109f12",
  39. "time": "2019/11/10 13:42:17",
  40. "expd": "2070/01/01 08:00:00",
  41. "rest": "00:00:00:00",
  42. "data": "1.2367209",
  43. "natt": "21",
  44. "nalr": "8",
  45. "tatt": "50",
  46. "talr": "102",
  47. "tusg": "10.3426",
  48. "matt": "100",
  49. "malr": "500",
  50. "musg": "1000",
  51. "self": "N",
  52. }]
  53. }
Request
func Function code 73
wtrm A water mark that copied to the response message
Response
func Function code 73
wtrm A water mark that copied from the request message
errc Compiler error code
nagt Number of instances
agts Neuron instance list
uuid UUID
time Last information update time
expd System expired date
rest Time left for the system inactive
data Data usage
natt No of attributes
nalr No of alarm points
tatt Total no. of attributes
talr Total no. of alarm points
tusg Total data usage amount
matt Maximum no. of attributes
malr Maximum no. of alarm points
tusg Maximum data usage amount
self Self Flag (Y/N)

Function 74 About Information

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno74

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 74,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240"
  4. }

Request body syntax

  1. {
  2. "func": 74,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0,
  5. "sysn": "NEURON SYSTEM v1.1.1",
  6. "cpyr": "Copyright (C) 2020, EMQ Technologies Co., Ltd. All rights
  7. reserved.",
  8. "modl": "ENT-x86_64-1-0101",
  9. "srno": "SN010101200227",
  10. "bver": " 1.1.1",
  11. "pver": 1,
  12. "host": "Instance 0",
  13. "expd": "2020/12/30 11:59:00",
  14. "rest": "306:23:03:07",
  15. "tatt": 2,
  16. "matt": 10000,
  17. "talr": 2,
  18. "malr": 1600,
  19. "tusg": 0.00010799,
  20. "musg": 100000000,
  21. "cont": "Joey Cheung (joey@emqx.io)",
  22. "uuid": "16538d28-4592-11e9-a787-00e067109f12"
  23. }
Request
func Function code 74
wtrm A water mark that copied to the response message
Response
func Function code 74
wtrm A water mark that copied from the request message
errc Compiler error code
sysn System Name
cpyr Copyright message
modl System model number
modl System serial number
bver Software build version
pver Protocol number
tatt Total no. of attributes in use
matt Max no. of attributes allowed
talr Total no. of alarms in use
malr Max no. of alarms allowed
tusg Total data usage
tusg Max data usage
cont Contact information
uuid UUID

Function 79 Show Alarms

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno79

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 79,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "actn": "act_en"
  5. }

Request body syntax

  1. {
  2. "func": 79,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0
  5. }
Request
func Function code 79
wtrm A water mark that copied to the response message
actn Action can be anyone of following
act_en Active enabled alarms
act_unack Active Unack alarms
act_all Active all alarms
all_alm All alarms
all_en All enabled alarms
all_dis All disabled alarms
Response
func Function code 79
wtrm A water mark that copied from the request message
errc Compiler error code

Function 80 Alarm Acknowledge

HTTP API Header

(POST)

Resource Path: /api/v1/funcno80

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 80,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "alid": 0,
  5. "actn": "acknowledge"
  6. }

Request body syntax

  1. {
  2. "func": 80,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0
  5. }
Request
func Function code 80
wtrm A water mark that copied to the response message
alid This ID is given out by the gateway in the heartbeat message. Copy the one which is being acknowledge.
actn Action can be anyone of following
acknowledge
enable
disable
Response
func Function code 80
wtrm A water mark that copied from the request message
errc Compiler error code

Function 81 Read Historical Alarm

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno81

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 81,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "srch": "FromFirst",
  5. "sett": "",
  6. "tokn": "",
  7. "ofst": 0,
  8. "fryr": 2020,
  9. "frmo": 1,
  10. "frda": 2,
  11. "frhr": 10,
  12. "frmi": 0,
  13. "toyr": 2020,
  14. "tomo": 2,
  15. "toda": 24,
  16. "tohr": 22,
  17. "tomi": 0,
  18. "cate": "alarm",
  19. "patn": "Temp"
  20. }

Request body syntax

  1. {
  2. "func": 81,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "frti": 1577930400,
  6. "toti": 1582552859,
  7. "nalm": 10,
  8. "ordr": "ascending",
  9. "rows": [{
  10. "anum": 1,
  11. "tstp": 1581482963,
  12. "uack": "",
  13. "cate": "alarm",
  14. "stat": "on",
  15. "comt": "temp2@Temp (791) < low@Temp (800)"
  16. },
  17. {
  18. "anum": 2,
  19. "tstp": 1581484493,
  20. "uack": "",
  21. "cate": "alarm",
  22. "stat": "off",
  23. "comt": "temp2@Temp (0) < low@Temp (0)"
  24. },
  25. {
  26. "anum": 3,
  27. "tstp": 1581485070,
  28. "uack": "",
  29. "cate": "alarm",
  30. "stat": "ack",
  31. "comt": "temp2@Temp (791) < low@Temp (790)"
  32. },
  33. {
  34. "anum": 4,
  35. "tstp": 1581513521,
  36. "uack": "",
  37. "cate": "alarm",
  38. "stat": "on",
  39. "comt": "temp1@Temp (0) < low@Temp (790)"
  40. },
  41. {
  42. "anum": 5,
  43. "tstp": 1581513521,
  44. "uack": "",
  45. "cate": "alarm",
  46. "stat": "on",
  47. "comt": "temp2@Temp (0) < low@Temp (790)"
  48. },
  49. {
  50. "anum": 6,
  51. "tstp": 1581513521,
  52. "uack": "",
  53. "cate": "alarm",
  54. "stat": "on",
  55. "comt": "temp3@Temp (0) < low@Temp (790)"
  56. },
  57. {
  58. "anum": 7,
  59. "tstp": 1581513580,
  60. "uack": "",
  61. "cate": "alarm",
  62. "stat": "off",
  63. "comt": "temp1@Temp (0) < low@Temp (0)"
  64. },
  65. {
  66. "anum": 8,
  67. "tstp": 1581513584,
  68. "uack": "",
  69. "cate": "alarm",
  70. "stat": "off",
  71. "comt": "temp2@Temp (0) < low@Temp (0)"
  72. },
  73. {
  74. "anum": 9,
  75. "tstp": 1581513592,
  76. "uack": "",
  77. "cate": "alarm",
  78. "stat": "off",
  79. "comt": "temp3@Temp (0) < low@Temp (0)"
  80. },
  81. {
  82. "anum": 10,
  83. "tstp": 1581515415,
  84. "uack": "",
  85. "cate": "alarm",
  86. "stat": "on",
  87. "comt": "temp2@Temp (791) < low@Temp (800)"
  88. }],
  89. "tokn": "5e44029700000003"
  90. }
Request
func Function code 81
wtrm A string that copied to the response message
srch Search Method
FromFirst — means forwards
FromLast — means backwards
UseID — use for consecutive search
Blank — means use FromYear
sett Today
Yesterday
ThisWeek
LastWeek
ThisMonth
LastMonth
Blank if using FromYear or ToYear below, can only be
combined with UseID or blank for first in SearchMethod
above
tokn ID string from previous request for next search. (only
together with UseID above)
ofst Offset for next search. positive or negative, only
together with UseID above, still using the search
pattern below
fryr From Year
frmo From Month (1-12)
frda From Day (1-31)
frhr From Hour (0-23)
frmi From Minute (0-59)
toyr To Year (1-12)
tomo To Month (1-31)
toda To Day (0-23)
tohr To Hour (0-59)
tomi To Minute (1-31)
cate Alarm Category
patn Search Pattern - check matching string anywhere in the
alarm text.
Response
func Function code 81
wtrm A string that copied from the request message
errc Compiler error code
frti From Datetime (timestamp)
toti To Datetime (timestamp)
nalm Total number of alarms found
ordr Order
ascending
descending
anum Alarm index number
tstp Alarm happening time
uack User who acknowledge this alarm
cate Alarm Category
stat Status
on — alarm on time
off — alarm off time
ack — alarm ack time
comt Alarm message
tokn ID string for next search

Function 82 Read Historical Trend

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno82

Content-Type: application/json

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 82,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "srcn": "Temp",
  5. "attn": "",
  6. "fend": 0,
  7. "tokn": -1,
  8. "fryr": 2020,
  9. "frmo": 1,
  10. "frda": 24,
  11. "frhr": 10,
  12. "frmi": 0,
  13. "toyr": 2020,
  14. "tomo": 2,
  15. "toda": 24,
  16. "tohr": 22,
  17. "tomi": 0
  18. }

Request body syntax

  1. {
  2. "func": 82,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "frti": 1519437600,
  6. "toti": 1582552859,
  7. "npts": 15082,
  8. "itvl": 1,
  9. "tele": [{
  10. "objn": "Temp",
  11. "tstp": 1581480345,
  12. "high": 0,
  13. "temp1": 0,
  14. "temp2": 0,
  15. "temp3": 0,
  16. "low": 0
  17. },
  18. {
  19. "objn": "Temp",
  20. "tstp": 1581480346,
  21. "high": 0,
  22. "temp1": 0,
  23. "temp2": 0,
  24. "temp3": 0,
  25. "low": 0
  26. },
  27. {
  28. "objn": "Temp",
  29. "tstp": 1581480347,
  30. "high": 0,
  31. "temp1": 0,
  32. "temp2": 0,
  33. "temp3": 0,
  34. "low": 0
  35. },
  36. {
  37. "objn": "Temp",
  38. "tstp": 1581480348,
  39. "high": 0,
  40. "temp1": 0,
  41. "temp2": 0,
  42. "temp3": 0,
  43. "low": 0
  44. }],
  45. "tokn": 3636
  46. }
Request
func Function code 82
wtrm A water mark that copied to the response message
srcn Object name with prefix and suffix
attn Attribute name (empty means all attributes)
fend Include the last point
1 — include
0 — not include
tokn File index number for next search
fryr From Year
frmo From Month (1-12)
frda From Day (1-31)
frhr From Hour (0-23)
frmi From Minute (0-59)
toyr To Year
tomo To Month (1-12)
toda To Day (1-31)
tohr To Hour (0-23)
tomi To Minute (0-59)
Response
func Function code 82
wtrm A water mark that copied from the request message
errc Compiler error code
frti From Datetime (timestamp)
toti To Datetime (timestamp)
npts Number of trend points found
itvl Time Interval between trend points
tele Telemetry array
objn Object name
tstp TimeStamp
tokn Token to implement next search

Function 83 Read Log

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno83

Content-Type: application/json

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 83,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "logl": "all",
  5. "srtt": 1604311512,
  6. "stpt": 1604311517,
  7. "srtl": 0
  8. }

Request body syntax

  1. {
  2. "func": 83,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "nrow": 500,
  5. "rows": [
  6. {
  7. "tstp": 1532419775,
  8. "logl": "warning"
  9. "data": " CORE extractlicense: loading certificate into memory"
  10. },
  11. {
  12. "tstp": 1532419775,
  13. "logl": "debug"
  14. "data": " DRV debuglog: Cannot connect"
  15. },
  16. {
  17. "tstp": 1532419775,
  18. "logl": "err"
  19. "data": " SERV serverdisconnect: send disconnection request failed,
  20. return code -3"
  21. },
  22. {
  23. "tstp": 1532419775,
  24. "logl": "warning"
  25. "data": " CORE update_process: process /home/neuron/
  26. /bin/neuron_o_mbstcp was killed by uncaught signal 9"
  27. },
  28. ],
  29. "last": 400,
  30. "errc": 0
  31. }
Request
func Function code 83
wtrm A water mark that copied to the response message
logl Log level,
allow text :
all,
debug,
info,
warning,
err
srtt Sart timestamp(s), default none
stpt End timestamp(s), default none, must with a nonempty
“srtt” if set value for “stpt”
srtl Start line number of the log file, also can be got from
“last” of response message,default 0
Response
func Function code 83
wtrm A water mark that copied from the request message
nrow Number of rows, <= 500
rows Rows of Log content, json array
tstp log timestamp (s)
logl Log level
data Log string data
last Last line number , useful for “strl” of request
message
errc Compiler error code

License Update HTTP API only

(POST)

Resource Path: /api/v1/license

Content-Type: multipart/form-data

HTTP status code Description
200 Successful operation
400 Invalid Operation

Error Response

The above gateway responses are assumed the request function are successfully handled. In case of failure to process the request, the gateway will return the following error message to the response topic.

Error response body syntax

  1. {
  2. "func": 14,
  3. "wtrm": "DEMO-Neuron-1001_1532419203896_239"
  4. "errc": 1001,
  5. "emsg": " Statement expected for this row "
  6. }
Response Compiler Error
func Function code
wtrm A string that copied from the request message
errc Compiler error code
emsg Error code Error text
0 , “No Error”
2 , “Function no has not found!”
3 , “Missing JSON item”
4 , “Invalid JSON structure”
10 , “Object locked”
11 , “Object not found”
12 , “Attribute locked”
13 , “Attribute not found”
14 , “Object number invalid”
15 , “Modification not allowed”
16 , “Attribute type invalid”
20 , “Operation not allowed”
21 , “Wrong password”
22 , “Wrong user name”
23 , “Not super user account”
24 , “System function error”
25 , “User not found”
26 , “Time out”
27 , “Default level”
28 , “Wrong number of levels”
29 , “User already exist”
30 , “Too many users”
40 , “Alarm not found”
41 , “Report empty”
42 , “Data format error”
43 , “Wrong revision”
44 , “Need rebuild file”
50 , “Too many global variables”
51 , “Global variable name length exceed”
52 , “Duplicated Global variables found”
53 , “Subroutine number not found”
54 , “Subroutine already exist”
55 , “No disk space for subroutine”
56 , “Search program number error”
57 , “No search string”
70 , “Wrong status change request”
71 , “Wrong gateway control request”
72 , “Wrong key”
73 , “Function not allowed in SEMI mode”
80 , “Attribute read only”
81 , “Object name error”
82 , “Data range error”
502 , “Too many channels”
503 , “Channel driver length size exceed maximum”
504 , “Channel driver invalid”
505 , “Channel driver type invalid”
506 , “Too many dummy variables”
507 , “Hostname length exceed maximum”
508 , “Port number is invalid”
509 , “Device file length too long”
510 , “Baud rate number is invalid”
511 , “Data bit invalid”
512 , “Stop bit invalid”
513 , “Parity bit invalid”
514 , “Too many objects”
515 , “Object ID length exceed maximum”
516 , “Object name length exceed maximum”
517 , “Duplicated object ID found”
518 , “Duplicated object name found”
519 , “Object size incorrect”
520 , “Update time incorrect”
521 , “Logging time incorrect”
522 , “Object status invalid”
523 , “Too many attributes”
524 , “Attribute status invalid”
525 , “Attribute type incorrect”
526 , “Attribute ID length exceed maximum”
527 , “Attribute name length exceed maximum”
528 , “Duplicated attribute ID found”
529 , “Duplicated attribute name found”
530 , “Decimal value invalid”
531 , “Attribute R/W length exceed maximum”
532 , “Attribute object number is not match”
533 , “Attribute object index is not match”
534 , “Prefix length exceed maximum”
535 , “Suffix length exceed maximum”
536 , “Prefix and Suffix string empty”
537 , “Tag address length exceed maximum”
538 , “Tag address invalid”
539 , “Tag address delimiter invalid”
540 , “Dummy sign invalid”
541 , “Tag address overlap”
542 , “Tag RW direction invalid”
543 , “Tag attribute is not match”
544 , “Tag bit type is not match”
545 , “Tag bit type error”
546 , “Tag ix exceed limit”
547 , “Tag array member invalid”
548 , “Alarm object name length exceed”
549 , “Alarm attribute name length exceed”
550 , “Alarm subroutine number not found”
551 , “Alarm category not found”
552 , “Alarm attribute not match”
553 , “Alarm ID not found”
554 , “Alarm type not found”
555 , “Alarm object name not found”
556 , “Tag name length exceed maximum”
557 , “Tag name invalid”
558 , “Duplicated tag name found”
559 , “Attribute tag length exceed”
560 , “Attribute tag not found”
561 , “Attribute tag index invalid”
562 , “Tag array invalid”
563 , “Tag type invalid”
564 , “Tag R/W direction invalid”
1001, “Statement expected for this row”
1002, “Statement does not exist”
1003, “INIT follows a normal statement (except REM, INIT)”
1004, “THEN expected after test statement”
1005, “Unexpected THEN, not a test above”
1006, “Unexpected ELIF/ELSE, not a THEN above”
1007, “Unknown statement”
1008, “GOTO undefined position (POSxxx)”
1009, “Error in POSxxx statement”
1010, “FATAL! Cannot solve all jump instruction”
2001, “Too many local variables in one file”
2002, “Syntax error in INIT (only assign local vars)”
2003, “INIT: assign (=) expected”
2004, “INIT: assign value expected”
2005, “INIT: expression delimiter (;) expected”
2006, “Syntax error in token”
2007, “Too long local variable name”
2008, “Syntax error in local variable”
2009, “Syntax error in constant”
2010, “Too long DB variable name”
2011, “Syntax error in [..] construction”
2012, “Syntax error in DB variable”
2013, “Syntax error in object variable”
2014, “Illegal label number”
2015, “Illegal subroutine number”
2016, “Too long global variable name”
2017, “Syntax error in global variable”
2018, “Syntax error in [index] construction”
2019, “Too long [index] name”
2020, “Syntax error in GOTO POSxxx instruction”
2021, “Syntax error in CALL SRxxx instruction”
2023, “Declaring a control variable”
2024, “Declaring too many local variables”
2025, “Local variable not declared/not a control variable”
2029, “Too long object name”
2030, “Too long field name”
2101, “Not an executable instruction/variable”
2102, “; expected after instruction”
2103, “No statement should follow RETURN/GOTO”
2104, “= expected after variable for assign”
2105, “; not allowed in test or inside parenthesis”
2106, “Instruction not allowed in test or inside parenthesis”
2107, “Operand expected”
2108, “Instruction should be first token in expression”
2109, “Operand/expression not expected”
2110, “Assign not allowed after test”
2111, “Assign variable is read-only”
2112, “) unexpected”
2113, “Object variable does not exist”
2114, “Index of Object variable not inside array”
2115, “Tag variable does not exist”
2116, “Index of Tag variable not inside array”
2117, “Unary used twice on same operand”
2118, “Unrecognized operator”
2119, “Application part for station does not exist”
2120, “Global variable does not exist”
2121, “Index of global variable not inside array”
2122, “, expected after variable declaration”
2123, “Index must be used on variable array”
2124, “Index cannot be used on single variable”
2125, “Operator is not allowed in double calculation”
2132, “Local variable as index is not used before”
2201, “Expression not completed”
2202, “Expression ended before resolving last parenthesis”
2300, “Global variable name too long”
2301, “Global variable name have capital letter”
2302, “Global variable length too large < 1000”
2303, “Global variable comment too long”