Skip to main content

The CertiScan Mobile SDK provides functions to communicate with Med-ic or eCAP. Each function is a command that launches an NFC reader session.

About NFC Reader Sessions

Calling any CertiScan SDK function will start an NFC reader session to detect a Med-ic or eCAP tag.

ios android

During the session, the function will perform a specific command on the tag and return JSON. This JSON output contains the command result and the information of the scanned tag.

If the session does not detect a tag within 1 minute, it will time out and return JSON output with error_code: 4003.

Example A:
NFC Reader session timeout

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

getTagMessage

Retrieve the data from Med-ic or eCAP.

import CertiScanSDK

func runGetTagMessageCommand() {

NFCAPIManager.getTagMessage
{ responseJsonString in
if let output = responseJsonString {
print("output = \(output)")
}
}

}
Console
output={
"tag_message" : {
"package_id" : "My Package ID",
"patient_id" : "Patient_1",
"tag_events" : [
{
"timestamp" : 1623862993,
"type" : 1
},
{
"timestamp" : 1623862993,
"type" : 2
},
{
"timestamp" : 1623862993,
"type" : 6
}
],
"tag_id" : "500465364-PR2",
"event_count" : 3,
"custom_data_1" : "My Custom Data A",
"scan_time" : 1626789791,
"versioning" : {
"hardware_version" : "1.0.1",
"firmware_version" : "1.1.1.0.0.4.1",
"model" : "Med-ic"
},
"started" : true,
"clock_coefficient_correction" : true
},
"command_code" : 1,
"success" : true
}

start

Start a smart package w/wo grid check, medic configuration, and dynamic buffer uploads.

ParametersDescription
ignoreGridTestBoolean value to determine if grid check should be ignored.
gridLineCountGrid line count for Medic package. Set null for eCAP package or for a Medic package that has already been configured.
enabledGridLinesAn array of the enabled grid line IDs for the Medic package. Set null for eCAP package or for a Medic package that has already been configured.
packageIDPackage ID (Dynamic Buffer) of the smart package. Set to null to prevent modification.
patientIDPatient ID (Dynamic Buffer) of the smart package. Set to null to prevent modification.
customData1Custom data (Dynamic Buffer) of the smart package. Set to null to prevent modification.
import CertiScanSDK

func runStartCommand() {
// start a Medic package with 23 enabled dose
var enabledGridLineArray = [Int]()
for lineID in 1..<24 {
enabledGridLineArray.append(lineID)
}

NFCAPIManager.start(ignoreGridTest: false,
gridLineCount: 23,
enabledGridLines: enabledGridLineArray,
packageID: "100000001",
patientID: "10001",
customData1: "medic")
{ responseJsonString in
if let output = responseJsonString {
print("output = \(output)")
}
}

}
Console
output={
"tag_message" : {
"package_id" : "100000001",
"custom_data_1" : "medic",
"clock_coefficient_correction" : false,
"patient_id" : "10001",
"event_count" : 0,
"versioning" : {
"hardware_version" : "1.0.1",
"firmware_version" : "1.1.1.0.0.4.1",
"model" : "Med-ic"
},
"started" : true,
"scan_time" : 1628088202,
"tag_id" : "500465357-PR4"
},
"command_code" : 2,
"success" : true
}

stop

Stop a smart package with or without setting a dynamic buffer.

ParametersDescription
packageIDPackage ID (Dynamic Buffer) of the smart package. Set to null to prevent modification.
patientIDPatient ID (Dynamic Buffer) of the smart package. Set to null to prevent modification.
customData1Custom data (Dynamic Buffer) of the smart package. Set to null to prevent modification.
import CertiScanSDK

func runStopCommand() {
// stop
NFCAPIManager.stop(packageID: "100000002",
patientID: "10002",
customData1: "CertiScan")
{ responseJsonString in
if let output = responseJsonString {
print("output = \(output)")
}
}

}
Console
output={
"tag_message" : {
"custom_data_1" : "CertiScan",
"event_count" : 0,
"patient_id" : "10002",
"clock_coefficient_correction" : false,
"package_id" : "100000002",
"scan_time" : 1628100362,
"tag_id" : "500465364-PR4",
"versioning" : {
"hardware_version" : "1.0.1",
"firmware_version" : "1.1.1.0.0.4.1",
"model" : "Med-ic"
},
"started" : false
},
"command_code" : 3,
"success" : true
}

setDynamicBuffers

Set Dynamic Buffer(s) of a smart package. The value of each dynamic buffer cannot be an empty string (“”) if multiple Dynamic Buffers are set simultaneously. Use Clear Dynamic Buffers to remove the value of Dynamic Buffer.

ParametersDescription
packageIDPackage ID of the smart package. Set to null to prevent modification.
patientIDPatient ID of the smart package. Set to null to prevent modification.
customData1Custom data of the smart package. Set to null to prevent modification.
import CertiScanSDK

func setDynamicBuffers() {
// set dynamic buffers
NFCAPIManager.setDynamicBuffers(packageID: "100000003",
patientID: "10003",
customData1: nil)
{ responseJsonString in
if let output = responseJsonString {
print("output = \(output)")
}
}

}
Console
output={
"tag_message" : {
"tag_id" : "500465364-PR8",
"clock_coefficient_correction" : false,
"package_id" : "100000003",
"versioning" : {
"hardware_version" : "1.0.1",
"firmware_version" : "1.1.1.0.0.4.1",
"model" : "Med-ic"
},
"started" : true,
"event_count" : 0,
"custom_data_1" : "",
"patient_id" : "10003",
"scan_time" : 1628102490
}
"command_code" : 4,
"success" : true
}

clearDynamicBuffers

Clear a Dynamic Buffer for the smart package. Passing the key of Dynamic Buffer to this function will clear the value of the buffer. The keys are list below:

KeyDescription
package_idPackage ID of the smart package.
patient_idPatient ID of the smart package.
custom_data_1Custom data of the smart package.
import CertiScanSDK

func clearDynamicBuffers() {
// clear dynamic buffers
NFCAPIManager.clearDynamicBuffer("package_id")
{ responseJsonString in
if let output = responseJsonString {
print("output = \(output)")
}
}

}
Console
output={
"tag_message" : {
"tag_id" : "500465364-PR8",
"patient_id" : "10003",
"package_id" : "",
"scan_time" : 1628104567,
"event_count" : 0,
"clock_coefficient_correction" : false,
"versioning" : {
"hardware_version" : "1.0.1",
"firmware_version" : "1.1.1.0.0.4.1",
"model" : "Med-ic"
},
"started" : true,
"custom_data_1" : ""
},
"command_code" : 5,
"success" : true
}