Skip to main content

JSON Output

When calling a native command function to run a command, a JSON string is replied as a result. JSON output has the following fields:

command_code

Each SDK function has its own command_code. The table below displays the corresponding command_code value for each command.

Commandcommand_code (Integer)
getTagMessage1
start2
stop3
setDynamicBuffers4
clearDynamicBuffers5

success

true if run the function successfully. Otherwise, it is false and there will be values for error_code and error_desc.

tag_message

The tag_message is a snapshot of the tag's data at the time of scanning. The output for tag_message is fully processed and has the following structure:

KeyDescription
tag_idAn ID that uniquely identifies each tag.
startedtrue if the state of the smart package is started and recording. For more information about tag states, see Tag States and Tag Lifecycle.
package_idPackage ID.
patient_idPatient ID.
custom_data_1Custom Data 1.
scan_timeUnix UTC timestamp for when the package was scanned.
clock_coefficient_correctiontrue if the clock coefficient correction is enabled. See Tag Timekeeping System - Accuracy for more information.
event_countDose event count.
tag_eventsDose event list. See tag_events below.
versioningTag's versioning. See versioning below.

tag_events

The tag_events is an array of the dose records stored on the tag. The output for tag_events is fully processed and has the following structure:

KeyDescription
typeDose type: an integer that indicates which cavity in the blister pack the dose was taken from. Only applies to Med-ic packages. See Med-ic Dose Types for more information.
timesetampUnix UTC timestamp for each dose detected. See Tag Timekeeping System for more information.

versioning

The versioning contains the tag's model, firmware version, and hardware version. The output for versioning is fully processed and has the following structure:

KeyDescription
modelTag model: "Med-ic", "eCap Argus-Loc" or "eCap Screw-Loc".
firmware_versionFirmware version.
hardware_versionHardware version.

error_code

The error_code indicates the error that occurred when the function was run.

error_codeDescriptions
4000Unknown error.
4001NFC Reader is unavailable.
4002NFC Reader error.
4003NFC Reader session timeout.
4004Invalid Tag ID.
4005Invalid command.
4006Tag state invalid for command.
4007Invalid command input.
4008Command authentication failed.
4009Command not authorized.
4010Tag not found.
4011Tag Mismatch (by Tag ID).
4012Max try error.
4013Command is not supported.
4014System command error.
4015Failed to connect the tag.
4016Failed to send the command.
4017Command response exception.
4018Manifest malformed exception.
4019Tag is not supported.
4020Tag malformed exception.

error_desc

Human-readable error description based on the error_code.

Example A:
NFC Reader session timeout

Output:
{
"command_code" : 1,
"success" : false,
"error_code":4003,
"error_desc":"NFC Reader session timeout."
}