Members
descriptors :Array.<VP3300~Descriptor>
List of Vendor Id & Product Id pairs that this driver supports.
Example
console.log('The Support vendorId & productIds for this device are:');
for (const {vendorId, productId} of Agent.Peripherals.IDTech.VP3300.descriptors) {
console.log(`vendorId: ${vendorId} productId: ${productId}`);
}
driverName :String
The name of this driver
Example
// Inside an async function
console.log(`The name of this driver is ${Agent.Peripherals.IDTech.VP3300.driverName}`);
Methods
(async) activateTransaction(configuration) → {Promise.<module:VP3300~ActivateTransactionResponse>}
Activate Transaction Command
Parameters:
Name | Type | Description |
---|---|---|
configuration |
ActivateTransactionConfiguration |
The configuration for the transaction |
Example
const response = await Agent.Peripherals.IDTech.VP3300.activateTransaction();
if (response.statusCode === 87) console.log('Reading NFC was successful');
else if (response.statusCode === 8) console.log('NFC read timeout');
else if (response.statusCode === 10) console.log('NFC reading not completed');
else console.error(`Driver Error: Status Code ${response.statusCode} ${response.status}`);
// The information passed by the NFC Device will be in "response.payload"
const payload = response.payload;
(async) getDeviceInfo() → {Promise.<module:VP3300~DeviceInfo>}
Example
// Inside an async function
const lookupOperationalStatus = {
'1': 'Operational',
'2': 'Unknown',
'3': 'Error',
'4': 'Inactive'
};
const lookupConnectivityStatus = {
'1': 'Connected',
'2': 'Disconnected'
};
const info = await Agent.Peripherals.IDTech.VP3300.getDeviceInfo();
console.log(`Device connectivity status: ${lookupConnectivityStatus[info.status.connectivityStatus]}`);
console.log(`Device operation status: ${lookupOperationalStatus[info.status.operationalStatus]}`);
console.log(`Device usb vendorId: 0x${info.device.vendorId.toString('16')}`);
console.log(`Device usb productId: 0x${info.device.productId.toString('16')}`);
console.log(`Device usb manufacturer: ${info.device.manufacturerName}`);
console.log(`Device usb product: ${info.device.productName}`);
console.log(`Device usb serial no: ${info.device.serial}`);
console.log(`Device driver version: ${info.driverVersion}`);
console.log(`Device manufacturer: ${info.manufacturer}`);
console.log(`Device model: ${info.model}`);
console.log(`Device current firmware: ${info.currentFirmware}`);
console.log(`Device requires supported firmware? ${info.requiresSupportedFirmware ? 'Yes' : 'No'}`);
console.log(`Device supported firmware(s): ${info.supportedFirmwares.join()}`);
console.log(`Device supported descriptor(s): ${info.supportedDescriptors.map(({vendorId, productId}) => `vid: 0x${vendorId.toString(16)} & pid: ${productId.toString(16)}`).join()}`);
(async) isAttached() → {Promise.<Boolean>}
Is the device physically connected
Example
// Inside an async function
const isAttached = await Agent.Peripherals.IDTech.VP3300.isAttached();
console.log(`The device ${isAttached 'is' : 'is not'} attached`);
(async) isConnected() → {Promise.<Boolean>}
Is the device communication open and connected
Example
// Inside an async function
const isConnected = await Agent.Peripherals.IDTech.VP3300.isConnected();
console.log(`The device ${isConnected ? 'is' : 'is not'} connected`);
(async) isEnabled() → {Promise.<Boolean>}
Is the device enabled
Example
// Inside an async function
const isEnabled = await Agent.Peripherals.IDTech.VP3300.isEnabled();
console.log(`The device ${isEnabled ? 'is' : 'is not'} enabled`);
(async) setAppleVasLTPK(configuration) → {Promise.<module:VP3300~Response>}
Set the Long Term Private Key used by Apple VAS NFC Communication
Parameters:
Name | Type | Description |
---|---|---|
configuration |
AppleVasLTPKConfiguration |
The configuration for the Apple VAS LTPK |
Example
// NOTE: The long term private key is generated as follows:
// openssl ec -nout -text -in private-key.pem
// We take the *last 32 bytes* of the private key
const ltpk = Buffer.from('CAFEFEED...', 'hex');
const result = await Agent.Peripherals.IDTech.VP3300.setAppleVasLTPK({ltpk});
if (result.statusCode === 0) console.log('Setting Apple VAS LTPK was successful');
else console.error(`Setting Apple VAS LTPK Failed: statusCode: ${result.statusCode} message: ${result.status}`);
(async) setAppleVasMerchantID(configuration) → {Promise.<module:VP3300~Response>}
Configure the Apple VAS Merchant ID the device will use when communicating with Apple devices.
Parameters:
Name | Type | Description |
---|---|---|
configuration |
AppleVasMerchantIDConfiguration |
The configuration for the Apple VAS Merchant ID |
Example
// Using the CryptoJS library found here: https://www.npmjs.com/package/cryptojs
// Using the Node Buffer polyfill module found here: https://www.npmjs.com/package/buffer
const vasMerchantId = 'hello.world.password.meow';
const hexMerchantId = cryptojs.SHA256(vasMerchantId).toString();
const merchantID = Buffer.from(hexMerchantId, 'hex');
const result = await Agent.Peripherals.IDTech.VP3300.setAppleVasMerchantID({merchantID});
if (result.statusCode === 0) console.log('Setting Apple VAS Merchant ID was successful');
else console.error(`Setting Apple VAS Merchant ID Failed: statusCode: ${result.statusCode} message: ${result.status}`);
(async) setEncryptionSwitch() → {Promise.<module:VP3300~Response>}
Set the Encryption switch
Example
const result = await Agent.Peripherals.IDTech.VP3300.setEncryptionSwitch();
if (result.statusCode === 0) console.log('Setting Encryption Switch was successful');
else console.error(`Setting Encryption Switch Failed: statusCode: ${result.statusCode} message: ${result.status}`);
(async) setSmartTapCollectorID(configuration) → {Promise.<module:VP3300~Response>}
Set the Collector ID used by Google Smart TAP NFC Communication
Parameters:
Name | Type | Description |
---|---|---|
configuration |
SmartTapCollectorIDConfiguration |
The configuration for the SmartTap Collector ID |
Example
const collectorID = Buffer.from('1234...', 'hex');
const result = await Agent.Peripherals.IDTech.VP3300.setSmartTapCollectorID({collectorID});
if (result.statusCode === 0) console.log('Setting Smart Tap Collector ID was successful');
else console.error(`Setting Smart Tap Collector ID Failed: statusCode: ${result.statusCode} message: ${result.status}`);
(async) setSmartTapLTPK(configuration) → {Promise.<module:VP3300~Response>}
Set the Long Term Private Key used by Google Smart TAP NFC Communication
Parameters:
Name | Type | Description |
---|---|---|
configuration |
SmartTapLTPKConfiguration |
The configuration for the SmartTap LTPK |
Example
// NOTE: The long term private key is generated as follows:
// openssl ec -nout -text -in private-key.pem
// We take the *last 32 bytes* of the private key
const keyVer = '00000001';
const ltpk = Buffer.from('CAFEFEED...', 'hex');
const result = await Agent.Peripherals.IDTech.VP3300.setSmartTapLTPK({keyVer, ltpk});
if (result.statusCode === 0) console.log('Setting Smart Tap LTPK was successful');
else console.error(`Setting Smart Tap LTPK Failed: statusCode: ${result.statusCode} message: ${result.status}`);