/
Configuration of Packet Parser

Configuration of Packet Parser

doc_tap_packetparser_implementation;

doc_tap_http1;

doc_tap_packetparser_hierarchy;

doc_tap_packetparser_hierarchy_example;

doc_tap_packetparser_scripts;

doc_tap_packetparser_scripts_link;

doc_tap_packetparser_moreinfo;

doc_tap_packetparser_protocols;

  • HTTP

  • TCP

  • UDP

  • FTP

  • MQTT

HTTP

SENDHTTPREQUEST

doc_tap_sendhttprequest;

SENDHTTPREQUEST( path, method, body, header1, header2… ) SENDHTTPREQUEST( HttpRequest )

Examples:

SENDHTTPREQUEST("/getValue") Result is: { "Headers": [ { "Key": "Content-Type", “Value": [“application/json"] }, { "Key": "Content-Length", “Value": ["1007"] }, ], "Content": "{\"value\":31}”, "ReasonPhrase": "OK", "StatusCode": 200, "IsSuccess": true }
SENDHTTPREQUEST("/doSomething", “POST”, “someData”, “header1:value1”, “header2:value2”, “header3:value3”)
VAR request := HTTPREQUEST(“/path”, “PUT”, “someData”); request.Headers := { “name1: value1”, “name2: value2” … }; request.Method := “POST”; VAR response := SENDHTTPREQUEST(request); IF response.IsSuccess VAR content := response.Content; END

TCP, UDP

SENDDATA

doc_tap_senddata;

SENDDATA( string/Collection<UInt8> )

Examples:

SENDATA(BYTECOLLECTION(“0a dd ef a2”) SENDATA(“{\”value\”:212}”)

COMPLETESERVICEATTRIBUTE

doc_tap_completeserviceattribute;

COMPLETESERVICEATTRIBUTE( attributeName, value, error )

Examples:

COMPLETESERVICEATTRIBUTE(“Uptime”, “2d:21h:43m”) COMPLETESERVICEATTRIBUTE(“Status”, “”, “Device is offline”)

COMPLETESERVICEACTION

doc_tap_completeserviceaction;

COMPLETESERVICEACTION( actionName, result )

Examples:

COMPLETESERVICEACTION(“Reboot”, “Rebooted successfully”) COMPLETESERVICEACTION(“Enable cloud”, “Device is offline”)

FTP

FTPDOWNLOAD

doc_tap_ftpdownload;

FTPDOWNLOAD( pathToFile )

Examples:

FTPDOWNLOAD(“/path/to/file”) (Result is Collection<UInt8>)

FTPUPLOAD

doc_tap_ftpupload;

FTPUPLOAD( pathToFile, data, mode )

Examples:

FTPUPLOAD(“/path/to/file”, “some data”, “write”) FTPUPLOAD(“/path/to/file”, BYTECOLLECTION(“a7 ff e2”), “append”)

MQTT

doc_tap_packetparser_mqtt;

MQTTPUBLISH

doc_tap_mqttpublish;

MQTTPUBLISH( topic, message )

Examples:

MQTTPUBLISH(“shellies/deviceid/relay/0/command”, “off”)

Listener script

doc_tap_pp_listener_script_description;

doc_tap_pp_listener_script_improvements_heading;

doc_tap_pp_listener_script_instead_of;

VAR jsonResponse := TOSTRING(RECEIVEDBYTES); if parsejson(jsonResponse, "Topic") = "my-topic" Va := todouble(parsejson(jsonResponse, "Payload")); end

doc_tap_pp_listener_script_new_way;

if RECEIVEDMSG.TOPIC = "my-topic" Va := todouble(TOSTRING(RECEIVEDMSG.PAYLOAD)); end

doc_tap_pp_listener_script_new_way_description;

doc_tap_pp_listener_script_packet_analysis_heading;

doc_tap_pp_listener_script_packet_analysis_description;

Related content