diff --git a/apidoc/NfcISO15693TagTchnology.yml b/apidoc/NfcISO15693TagTchnology.yml new file mode 100644 index 0000000..84b5e75 --- /dev/null +++ b/apidoc/NfcISO15693TagTchnology.yml @@ -0,0 +1,621 @@ +name: Modules.Nfc.ISO15693TagTechnology +summary: Provides access to ISO 15693 properties and I/O operations on a . +description: | + The NFCTagReaderSessionDelegate receives an object that conforms to the NFCISO15693Tag protocol when the NFCTagReaderSession detects an ISO 15693-compatible tag. For the delegate to receive the tag object, your app must include the Near Field Communication Tag Reader Session Formats Entitlement. + For the reader session to read and write data to the tag, it must be available to the reader session. Use the isAvailable property to check the tag’s availability. + See also: + [Mifare Ultralight](https://developer.apple.com/documentation/corenfc/nfcmifaretag?language=objc) + +extends: Modules.Nfc.NativeTagTechnology +since: "1.1.0" +platforms: [iphone] + +methods: + - name: icManufacturerCode (New) + summary: The IC manufacturer code comes from bits 49 through 56 of the identifier data, in accordance with ISO/IEC 7816-6:2004. + + - name: icSerialNumber (New) + summary: The IC serial number assigned to the tag by the manufacturer. + + - name: identifier (New) + summary: The unique hardware identifier of the tag. + + - name: RequestFlag (New) + summary: A set of bit mask options that, when combined, define the request flags to use when sending a command. + + - name: readSingleBlockWithRequestFlags (New) + summary: Sends a Read Single Block command (0x20 command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: data + type: Titanium.Buffer + summary: A NSData object containing the blocks of data read from the tag. If the request flags include RequestFlagOption, the first byte of the data contains the associated block security status. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: writeSingleBlockWithRequestFlags (New) + summary: Sends the Write Single Block command (0x21 command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: dataBlock + type: Titanium.Buffer + summary: Thee block of data that would be written on the tag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: lockBlockWithRequestFlags (New) + summary: Sends the Lock Block command (0x22 command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: readMultipleBlocksWithRequestFlags (New) + summary: Sends the Read Multiple Blocks command (0x23 command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: dataBlock + type: Titanium.Buffer + summary: Thee block of data that would be written on the tag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: writeMultipleBlocksWithRequestFlags (New) + summary: Sends the Write Multiple Blocks command (0x24 command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: dataBlock + type: Titanium.Buffer + summary: Thee block of data that would be written on the tag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: getMultipleBlockSecurityStatusWithRequestFlag (New) + summary: Sends the Get Multiple Block Security Status command (0x2C command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockRange + type: Number + summary: the range of the block + - name: securityStatus + type: Number + summary: security status of code. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: writeAFIWithRequestFlag (New) + summary: Sends the Write AFI command (0x27 command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: afi + type: Number + summary: afi + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + + - name: lockAFIWithRequestFlag (New) + summary: Sends the Lock AFI command (0x28 command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: writeDSFIDWithRequestFlag (New) + summary: Sends the Write DSFID command (0x29 command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: dsfid + type: Number + summary: dsfid + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: resetToReadyWithRequestFlags (New) + summary: Sends the Reset To Ready command (0x26 command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: selectWithRequestFlags (New) + summary: Sends the Select command (0x25 command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: stayQuiet (New) + summary: Sends a Stay Quiet command (0x02 command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + + - name: customCommandWithRequestFlag (New) + summary: Sends a custom command (0xA0 to 0xDF command code), as defined in the ISO 15693-3 specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: customCommandCode + type: Number + summary: custom command code used to send with request flag. + - name: customRequestparameterss + type: Titanium.Buffer + summary: request parameter will be send with request flag. + - name: customResponseparameterss + type: Titanium.Buffer + summary: custom response parameter. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: extendedReadSingleBlockWithRequestFlags (New) + summary: Sends the Extended Read Single Block command (0x30 command code), as defined in the NFC Forum Type 5 tag specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: data + type: Titanium.Buffer + summary: data received from tag + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: extendedWriteSingleBlockWithRequestFlags (New) + summary: Sends the Extended Write Single Block command (0x31 command code), as defined in the NFC Forum Type 5 tag specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: dataBlock + type: Titanium.Buffer + summary: Thee block of data that would be written on the tag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: extendedLockBlockWithRequestFlags (New) + summary: Sends the Extended Lock Single Block command (0x32 command code), as defined in the NFC Forum Type 5 tag specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: extendedReadMultipleBlocksWithRequestFlags (New) + summary: Sends the Extended Read Multiple Block command (0x33 command code), as defined in the NFC Forum Type 5 tag specification, to the tag. + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: dataBlock + type: Titanium.Buffer + summary: Thee block of data that would be written on the tag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: lockDSFIDWithRequestFlag (New) + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: authenticateWithRequestFlags (New) + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: cryptoSuiteIdentifier + type: Number + summary: crypto suite identifier value + - name: message + type: Titanium.Buffer + summary: message that will be send to tag + - name: responseFlag + type: Number + summary: response flag we get from flag. + - name: response + type: Titanium.Buffer + summary: response from the tag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: challengeWithRequestFlags (New) + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: cryptoSuiteIdentifier + type: Number + summary: crypto suite identifier value + - name: message + type: Titanium.Buffer + summary: message that will be send to tag + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + + - name: extendedFastReadMultipleBlocksWithRequestFlag (New) + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: dataBlock + type: Titanium.Buffer + summary: Thee block of data that would be written on the tag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: extendedGetMultipleBlockSecurityStatusWithRequestFlag (New) + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: securityStatus + type: Number + summary: security status of the tag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: extendedWriteMultipleBlocksWithRequestFlags (New) + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: dataBlock + type: Titanium.Buffer + summary: Thee block of data that would be written on the tag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: fastReadMultipleBlocksWithRequestFlag (New) + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: blockNumber + type: Number + summary: The number of the block to read. Blocks are numbered from 0 to 255 inclusively. + - name: dataBlock + type: Titanium.Buffer + summary: Thee block of data that would be written on the tag. + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: getSystemInfoAndUIDWithRequestFlag (New) + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: dsfid + type: Number + summary: dsfid of tag + - name: afi + type: Number + summary: afi of tag + - name: blockSize + type: Number + summary: block size of tag data. + - name: blockCount + type: Number + summary: block count of tag. + - name: icReference + type: Number + summary: id reference of tag. + - name: uid + type: Titanium.Buffer + summary: uid of tag + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: keyUpdateWithRequestFlags (New) + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: keyIdentifier + type: Number + summary: key identifier of tag + - name: message + type: Titanium.Buffer + summary: message send to tag + - name: responseFlag + type: Number + summary: response flag from tag + - name: response + type: Titanium.Buffer + summary: response from tag + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + + - name: readBufferWithRequestFlags (New) + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: responseFlag + type: Number + summary: response flag with tag + - name: data + type: Titanium.Buffer + summary: data with tag + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. + + - name: sendRequestWithFlag (New) + parameters: + - name: flags + type: Number + summary: The request flags. The RequestFlagAddress flag is enforced by default. However, using the RequestFlagSelect flag disables the RequestFlagAddress flag. + - name: commandCode + type: Number + summary: command code to send with flag. + - name: data + type: Titanium.Buffer + summary: Thee data that will send with flag. + - name: responseFlag + type: Number + summary: response flag found with tag + - name: data + type: Titanium.Buffer + summary: data with tag + - name: errorCode + type: String + summary: The error code; only present if an error occurred. + - name: errorDomain + type: String + summary: The error domain; only present if an error occurred. + - name: errorDescription + type: String + summary: The error description; only peresent if an error occurred. \ No newline at end of file diff --git a/ios/Classes/TiNfcModule.m b/ios/Classes/TiNfcModule.m index 9763d2d..6608038 100644 --- a/ios/Classes/TiNfcModule.m +++ b/ios/Classes/TiNfcModule.m @@ -41,6 +41,14 @@ - (void)startup NSLog(@"[DEBUG] %@ loaded", self); } +MAKE_SYSTEM_PROP(NFC_ISO15693_REQUEST_FLAG_ADDRESS, NFCISO15693RequestFlagAddress); +MAKE_SYSTEM_PROP(NFC_ISO15693_REQUEST_FLAG_COMMAND_SPECIFIC_BIT8, NFCISO15693RequestFlagCommandSpecificBit8); +MAKE_SYSTEM_PROP(NFC_ISO15693_REQUEST_FLAG_DUAL_SUB_CARRIERS, NFCISO15693RequestFlagDualSubCarriers); +MAKE_SYSTEM_PROP(NFC_ISO15693_REQUEST_FLAG_HIGH_DATA_RATE, NFCISO15693RequestFlagHighDataRate); +MAKE_SYSTEM_PROP(NFC_ISO15693_REQUEST_FLAG_OPTION, NFCISO15693RequestFlagOption); +MAKE_SYSTEM_PROP(NFC_ISO15693_REQUEST_FLAG_PROTOCOL_EXTENSION, NFCISO15693RequestFlagProtocolExtension); +MAKE_SYSTEM_PROP(NFC_ISO15693_REQUEST_FLAG_SELECT, NFCISO15693RequestFlagSelect); + MAKE_SYSTEM_STR(READER_SESSION_NFC_NDEF, @"NFCNDEFReaderSession"); MAKE_SYSTEM_STR(READER_SESSION_NFC_TAG, @"NFCTagReaderSession"); MAKE_SYSTEM_PROP(NFC_TAG_ISO14443, NFCPollingISO14443); diff --git a/ios/Classes/TiNfcVTagTechnology.h b/ios/Classes/TiNfcVTagTechnology.h index 30abb99..60ad919 100644 --- a/ios/Classes/TiNfcVTagTechnology.h +++ b/ios/Classes/TiNfcVTagTechnology.h @@ -12,6 +12,39 @@ NS_ASSUME_NONNULL_BEGIN @interface TiNfcVTagTechnology : TiNfcNativeTagTechnologyProxy + +- (TiBuffer *)identifier; +- (NSNumber *)icManufacturerCode; +- (TiBuffer *)icSerialNumber; +- (void)readSingleBlockWithRequestFlags:(id)args; +- (void)writeSingleBlockWithRequestFlags:(id)args; +- (void)lockBlockWithRequestFlags:(id)args; +- (void)readMultipleBlocksWithRequestFlags:(id)args; +- (void)writeMultipleBlocksWithRequestFlags:(id)args; +- (void)getMultipleBlockSecurityStatusWithRequestFlag:(id)args; +- (void)writeAFIWithRequestFlag:(id)args; +- (void)lockAFIWithRequestFlag:(id)args; +- (void)writeDSFIDWithRequestFlag:(id)args; +- (void)resetToReadyWithRequestFlags:(id)args; +- (void)selectWithRequestFlags:(id)args; +- (void)stayQuiet:(id)args; +- (void)customCommandWithRequestFlag:(id)args; +- (void)extendedReadSingleBlockWithRequestFlags:(id)args; +- (void)extendedWriteSingleBlockWithRequestFlags:(id)args; +- (void)extendedLockBlockWithRequestFlags:(id)args; +- (void)extendedReadMultipleBlocksWithRequestFlags:(id)args; +- (void)lockDSFIDWithRequestFlag:(id)args; +- (void)authenticateWithRequestFlags:(id)args; +- (void)challengeWithRequestFlags:(id)args; +- (void)extendedFastReadMultipleBlocksWithRequestFlag:(id)args; +- (void)extendedGetMultipleBlockSecurityStatusWithRequestFlag:(id)args; +- (void)extendedWriteMultipleBlocksWithRequestFlags:(id)args; +- (void)fastReadMultipleBlocksWithRequestFlag:(id)args; +- (void)getSystemInfoAndUIDWithRequestFlag:(id)args; +- (void)keyUpdateWithRequestFlags:(id)args; +- (void)readBufferWithRequestFlags:(id)args; +- (void)sendRequestWithFlag:(id)args; + @end NS_ASSUME_NONNULL_END diff --git a/ios/Classes/TiNfcVTagTechnology.m b/ios/Classes/TiNfcVTagTechnology.m index 6d01fa3..084283e 100644 --- a/ios/Classes/TiNfcVTagTechnology.m +++ b/ios/Classes/TiNfcVTagTechnology.m @@ -9,4 +9,698 @@ @implementation TiNfcVTagTechnology +- (NSNumber *)icManufacturerCode +{ + return NUMINTEGER([[self.tagProxy asNFCISO15693Tag] icManufacturerCode]); +} + +- (TiBuffer *)identifier +{ + TiBuffer *identifier = [[TiBuffer alloc] _initWithPageContext:[self pageContext]]; + NSMutableData *data = [NSMutableData dataWithData:[[self.tagProxy asNFCISO15693Tag] identifier]]; + [identifier setData:data]; + return identifier; +} + +- (TiBuffer *)icSerialNumber +{ + TiBuffer *historicalBytes = [[TiBuffer alloc] _initWithPageContext:[self pageContext]]; + NSMutableData *data = [NSMutableData dataWithData:[[self.tagProxy asNFCISO15693Tag] icSerialNumber]]; + [historicalBytes setData:data]; + return historicalBytes; +} + +- (NSData *)arrayToData:(NSArray *)dataBlock +{ + unsigned int dataValue[dataBlock.count]; + for (int i = 0; i < dataBlock.count; i++) { + dataValue[i] = [dataBlock[i] unsignedIntValue]; + } + NSData *data = [[NSData alloc] initWithBytes:dataValue length:dataBlock.count]; + return data; +} + +- (void)readSingleBlockWithRequestFlags:(id)args +{ + + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *blockNumberValue = [[args firstObject] valueForKey:@"blockNumber"]; + uint8_t blockNumber = [blockNumberValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] readSingleBlockWithRequestFlags:requestFlags + blockNumber:blockNumber + completionHandler:^(NSData *_Nonnull data, NSError *_Nullable error) { + if (![self _hasListeners:@"didReadSingleBlockWithRequestFlags"]) { + return; + } + TiBuffer *responseData = [[TiBuffer alloc] _initWithPageContext:[self pageContext]]; + NSMutableData *responsevalue = [NSMutableData dataWithData:data]; + [responseData setData:responsevalue]; + + [self fireEvent:@"didReadSingleBlockWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null], + @"responseDataLength" : responseData + + }]; + }]; +} + +- (void)writeSingleBlockWithRequestFlags:(id)args +{ + + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *blockNumberValue = [[args firstObject] valueForKey:@"blockNumber"]; + uint8_t blockNumber = [blockNumberValue unsignedCharValue]; + + NSArray *dataBlock = [[args firstObject] valueForKey:@"dataBlock"]; + NSData *data = [self arrayToData:dataBlock]; + + [[self.tagProxy asNFCISO15693Tag] writeSingleBlockWithRequestFlags:requestFlags + blockNumber:blockNumber + dataBlock:data + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didWriteSingleBlockWithRequestFlags"]) { + return; + } + [self fireEvent:@"didWriteSingleBlockWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)lockBlockWithRequestFlags:(id)args +{ + + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *blockNumberValue = [[args firstObject] valueForKey:@"blockNumber"]; + uint8_t blockNumber = [blockNumberValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] lockBlockWithRequestFlags:requestFlags + blockNumber:blockNumber + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didLockBlockWithRequestFlags"]) { + return; + } + [self fireEvent:@"didLockBlockWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)readMultipleBlocksWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *blockNumberValue = [[args firstObject] valueForKey:@"blockNumber"]; + uint8_t blockNumber = [blockNumberValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] readSingleBlockWithRequestFlags:requestFlags + blockNumber:blockNumber + completionHandler:^(NSData *_Nonnull data, NSError *_Nullable error) { + if (![self _hasListeners:@"didReadMultipleBlocksWithRequestFlags"]) { + return; + } + TiBuffer *responseData = [[TiBuffer alloc] _initWithPageContext:[self pageContext]]; + NSMutableData *responsevalue = [NSMutableData dataWithData:data]; + [responseData setData:responsevalue]; + [self fireEvent:@"didReadMultipleBlocksWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null], + @"responseDataLength" : responseData + + }]; + }]; +} + +- (void)writeMultipleBlocksWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSArray *dataBlock = [[args firstObject] valueForKey:@"blockNumber"]; + NSData *data = [self arrayToData:dataBlock]; + + NSArray *dataBlocks = [[NSArray alloc] initWithObjects:data, nil]; + + [[self.tagProxy asNFCISO15693Tag] writeMultipleBlocksWithRequestFlags:requestFlags + blockRange:NSMakeRange(0, 8) + dataBlocks:dataBlocks + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didWriteMultipleBlocksWithRequestFlags"]) { + return; + } + [self fireEvent:@"didWriteMultipleBlocksWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)getMultipleBlockSecurityStatusWithRequestFlag:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] getMultipleBlockSecurityStatusWithRequestFlag:requestFlags + blockRange:NSMakeRange(0, 8) + completionHandler:^(NSArray *_Nonnull securityStatus, NSError *_Nullable error) { + if (![self _hasListeners:@"didGetMultipleBlockSecurityStatusWithRequestFlag"]) { + return; + } + [self fireEvent:@"didGetMultipleBlockSecurityStatusWithRequestFlag" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)writeAFIWithRequestFlag:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *afiValue = [[args firstObject] valueForKey:@"applicationFamilyIdentifier"]; + uint8_t afi = [afiValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] writeAFIWithRequestFlag:requestFlags + afi:afi + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didWriteAFIWithRequestFlag"]) { + return; + } + [self fireEvent:@"didWriteAFIWithRequestFlag" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)lockAFIWithRequestFlag:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *afiValue = [[args firstObject] valueForKey:@"afi"]; + uint8_t afi = [afiValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] writeAFIWithRequestFlag:requestFlags + afi:afi + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didLockAFIWithRequestFlag"]) { + return; + } + [self fireEvent:@"didLockAFIWithRequestFlag" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)writeDSFIDWithRequestFlag:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *dsfidValue = [[args firstObject] valueForKey:@"dataStorageFormatIdentifier"]; + uint8_t dsfid = [dsfidValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] writeDSFIDWithRequestFlag:requestFlags + dsfid:dsfid + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didWriteDSFIDWithRequestFlag"]) { + return; + } + [self fireEvent:@"didWriteDSFIDWithRequestFlag" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)resetToReadyWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] resetToReadyWithRequestFlags:requestFlags + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didResetToReadyWithRequestFlags"]) { + return; + } + [self fireEvent:@"didResetToReadyWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)selectWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] selectWithRequestFlags:requestFlags + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didSelectWithRequestFlags"]) { + return; + } + [self fireEvent:@"didSelectWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)stayQuiet:(id)args +{ + [[self.tagProxy asNFCISO15693Tag] stayQuietWithCompletionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didStayQuiet"]) { + return; + } + [self fireEvent:@"didStayQuiet" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} +- (void)customCommandWithRequestFlag:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *customCommandCode = [[args firstObject] valueForKey:@"customCommandCode"]; + + NSArray *customRequestParameters = [[args firstObject] valueForKey:@"customRequestParameters"]; + NSData *data = [self arrayToData:customRequestParameters]; + + [[self.tagProxy asNFCISO15693Tag] customCommandWithRequestFlag:requestFlags + customCommandCode:[customCommandCode integerValue] + customRequestParameters:data + completionHandler:^(NSData *_Nonnull customResponseParameters, NSError *_Nullable error) { + if (![self _hasListeners:@"didCustomCommandWithRequestFlag"]) { + return; + } + TiBuffer *responseData = [[TiBuffer alloc] _initWithPageContext:[self pageContext]]; + NSMutableData *responsevalue = [NSMutableData dataWithData:customResponseParameters]; + [responseData setData:responsevalue]; + [self fireEvent:@"didCustomCommandWithRequestFlag" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null], + @"data" : responseData + }]; + }]; +} + +- (void)extendedReadSingleBlockWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *blockNumber = [[args firstObject] valueForKey:@"blockNumber"]; + + [[self.tagProxy asNFCISO15693Tag] extendedReadSingleBlockWithRequestFlags:requestFlags + blockNumber:[blockNumber integerValue] + completionHandler:^(NSData *_Nonnull data, NSError *_Nullable error) { + if (![self _hasListeners:@"didExtendedReadSingleBlockWithRequestFlags"]) { + return; + } + TiBuffer *responseData = [[TiBuffer alloc] _initWithPageContext:[self pageContext]]; + NSMutableData *responsevalue = [NSMutableData dataWithData:data]; + [responseData setData:responsevalue]; + [self fireEvent:@"didExtendedReadSingleBlockWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null], + @"data" : responseData + }]; + }]; +} + +- (void)extendedWriteSingleBlockWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *blockNumber = [[args firstObject] valueForKey:@"blockNumber"]; + + NSArray *dataBlock = [[args firstObject] valueForKey:@"blockNumber"]; + NSData *data = [self arrayToData:dataBlock]; + + [[self.tagProxy asNFCISO15693Tag] extendedWriteSingleBlockWithRequestFlags:requestFlags + blockNumber:[blockNumber integerValue] + dataBlock:data + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didExtendedReadSingleBlockWithRequestFlags"]) { + return; + } + [self fireEvent:@"didExtendedReadSingleBlockWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)extendedLockBlockWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *blockNumber = [[args firstObject] valueForKey:@"blockNumber"]; + + [[self.tagProxy asNFCISO15693Tag] extendedLockBlockWithRequestFlags:requestFlags + blockNumber:[blockNumber integerValue] + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didExtendedReadSingleBlockWithRequestFlags"]) { + return; + } + [self fireEvent:@"didExtendedReadSingleBlockWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)extendedReadMultipleBlocksWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *blockNumber = [[args firstObject] valueForKey:@"blockNumber"]; + + [[self.tagProxy asNFCISO15693Tag] extendedLockBlockWithRequestFlags:requestFlags + blockNumber:[blockNumber integerValue] + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didExtendedReadMultipleBlocksWithRequestFlags"]) { + return; + } + [self fireEvent:@"didExtendedReadMultipleBlocksWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)lockDSFIDWithRequestFlag:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] lockDSFIDWithRequestFlag:requestFlags + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didLockDSFIDWithRequestFlag"]) { + return; + } + [self fireEvent:@"didLockDSFIDWithRequestFlag" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)authenticateWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *cryptoSuiteIdentifier = [[args firstObject] valueForKey:@"cryptoSuiteIdentifier"]; + + NSArray *message = [[args firstObject] valueForKey:@"message"]; + NSData *data = [self arrayToData:message]; + + [[self.tagProxy asNFCISO15693Tag] authenticateWithRequestFlags:requestFlags + cryptoSuiteIdentifier:[cryptoSuiteIdentifier integerValue] + message:data + completionHandler:^(NFCISO15693ResponseFlag responseFlag, NSData *_Nonnull response, NSError *_Nullable error) { + if (![self _hasListeners:@"didAuthenticateWithRequestFlags"]) { + return; + } + [self fireEvent:@"didAuthenticateWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null], + @"responseFlag" : NUMUINT(responseFlag), + @"data" : data + }]; + }]; +} + +- (void)challengeWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *cryptoSuiteIdentifier = [[args firstObject] valueForKey:@"cryptoSuiteIdentifier"]; + + NSArray *message = [[args firstObject] valueForKey:@"message"]; + NSData *data = [self arrayToData:message]; + + [[self.tagProxy asNFCISO15693Tag] challengeWithRequestFlags:requestFlags + cryptoSuiteIdentifier:[cryptoSuiteIdentifier integerValue] + message:data + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didChallengeWithRequestFlags"]) { + return; + } + [self fireEvent:@"didChallengeWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)extendedFastReadMultipleBlocksWithRequestFlag:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] extendedFastReadMultipleBlocksWithRequestFlag:requestFlags + blockRange:NSMakeRange(0, 8) + completionHandler:^(NSArray *_Nonnull dataBlocks, NSError *_Nullable error) { + if (![self _hasListeners:@"didExtendedFastReadMultipleBlocksWithRequestFlag"]) { + return; + } + [self fireEvent:@"didExtendedFastReadMultipleBlocksWithRequestFlag" + withObject:@{ @"dataBlocks" : dataBlocks, + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] }]; + }]; +} + +- (void)extendedGetMultipleBlockSecurityStatusWithRequestFlag:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] extendedGetMultipleBlockSecurityStatusWithRequestFlag:requestFlags + blockRange:NSMakeRange(0, 8) + completionHandler:^(NSArray *_Nonnull securityStatus, NSError *_Nullable error) { + if (![self _hasListeners:@"didExtendedGetMultipleBlockSecurityStatusWithRequestFlag"]) { + return; + } + [self fireEvent:@"didExtendedGetMultipleBlockSecurityStatusWithRequestFlag" + withObject:@{ @"securityStatus" : securityStatus, + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] }]; + }]; +} + +- (void)extendedWriteMultipleBlocksWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSArray *dataBlock = [[args firstObject] valueForKey:@"blockNumber"]; + NSData *data = [self arrayToData:dataBlock]; + NSArray *dataBlocks = [[NSArray alloc] initWithObjects:data, nil]; + + [[self.tagProxy asNFCISO15693Tag] extendedWriteMultipleBlocksWithRequestFlags:requestFlags + blockRange:NSMakeRange(0, 8) + dataBlocks:dataBlocks + completionHandler:^(NSError *_Nullable error) { + if (![self _hasListeners:@"didExtendedWriteMultipleBlocksWithRequestFlags"]) { + return; + } + [self fireEvent:@"didExtendedWriteMultipleBlocksWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + +- (void)fastReadMultipleBlocksWithRequestFlag:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] fastReadMultipleBlocksWithRequestFlag:requestFlags + blockRange:NSMakeRange(0, 8) + completionHandler:^(NSArray *_Nonnull dataBlocks, NSError *_Nullable error) { + if (![self _hasListeners:@"didFastReadMultipleBlocksWithRequestFlag"]) { + return; + } + [self fireEvent:@"didFastReadMultipleBlocksWithRequestFlag" + withObject:@{ @"dataBlocks" : dataBlocks, + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] }]; + }]; +} + +- (void)getSystemInfoAndUIDWithRequestFlag:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] getSystemInfoAndUIDWithRequestFlag:requestFlags + completionHandler:^(NSData *_Nullable uid, NSInteger dsfid, NSInteger afi, NSInteger blockSize, NSInteger blockCount, NSInteger icReference, NSError *_Nullable error) { + if (![self _hasListeners:@"didGetSystemInfoAndUIDWithRequestFlag"]) { + return; + } + TiBuffer *uidData = [[TiBuffer alloc] _initWithPageContext:[self pageContext]]; + NSMutableData *responsevalue = [NSMutableData dataWithData:uid]; + [uidData setData:responsevalue]; + NSNumber *dsfidValue = NUMINTEGER(dsfid); + NSNumber *afiValue = NUMINTEGER(afi); + NSNumber *blockSizeValue = NUMINTEGER(blockSize); + NSNumber *blockCountValue = NUMINTEGER(blockCount); + NSNumber *icReferenceValue = NUMINTEGER(icReference); + [self fireEvent:@"didGetSystemInfoAndUIDWithRequestFlag" + withObject:@{ @"uid" : uidData, + @"dsfid" : dsfidValue, + @"afi" : afiValue, + @"blockSize" : blockSizeValue, + @"blockCount" : blockCountValue, + @"icReference" : icReferenceValue, + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] }]; + }]; +} + +- (void)keyUpdateWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + NSNumber *keyIdentifier = [[args firstObject] valueForKey:@"keyIdentifier"]; + + NSArray *message = [[args firstObject] valueForKey:@"message"]; + NSData *data = [self arrayToData:message]; + + [[self.tagProxy asNFCISO15693Tag] keyUpdateWithRequestFlags:requestFlags + keyIdentifier:[keyIdentifier integerValue] + message:data + completionHandler:^(NFCISO15693ResponseFlag responseFlag, NSData *_Nonnull response, NSError *_Nullable error) { + if (![self _hasListeners:@"didKeyUpdateWithRequestFlags"]) { + return; + } + TiBuffer *responseData = [[TiBuffer alloc] _initWithPageContext:[self pageContext]]; + NSMutableData *responsevalue = [NSMutableData dataWithData:response]; + [responseData setData:responsevalue]; + [self fireEvent:@"didKeyUpdateWithRequestFlags" + withObject:@{ @"response" : responseData, + @"responseFlag" : NUMUINT(responseFlag), + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] }]; + }]; +} + +- (void)readBufferWithRequestFlags:(id)args +{ + NSNumber *requestFlagsValue = [[args firstObject] valueForKey:@"requestFlags"]; + uint8_t requestFlags = [requestFlagsValue unsignedCharValue]; + + [[self.tagProxy asNFCISO15693Tag] readBufferWithRequestFlags:requestFlags + completionHandler:^(NFCISO15693ResponseFlag responseFlag, NSData *_Nonnull data, NSError *_Nullable error) { + if (![self _hasListeners:@"didReadBufferWithRequestFlags"]) { + return; + } + TiBuffer *responseData = [[TiBuffer alloc] _initWithPageContext:[self pageContext]]; + NSMutableData *responsevalue = [NSMutableData dataWithData:data]; + [responseData setData:responsevalue]; + [self fireEvent:@"didReadBufferWithRequestFlags" + withObject:@{ @"data" : responseData, + @"responseFlag" : NUMUINT(responseFlag), + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] }]; + }]; +} + +- (void)sendRequestWithFlag:(id)args +{ + NSNumber *flag = [[args firstObject] valueForKey:@"flag"]; + NSNumber *commandCode = [[args firstObject] valueForKey:@"commandCode"]; + + NSArray *commandData = [[args firstObject] valueForKey:@"data"]; + NSData *data = [self arrayToData:commandData]; + [[self.tagProxy asNFCISO15693Tag] sendRequestWithFlag:[flag integerValue] + commandCode:[commandCode integerValue] + data:data + completionHandler:^(NFCISO15693ResponseFlag responseFlag, NSData *_Nullable data, NSError *_Nullable error) { + if (![self _hasListeners:@"didReadBufferWithRequestFlags"]) { + return; + } + [self fireEvent:@"didReadBufferWithRequestFlags" + withObject:@{ + @"errorCode" : error != nil ? NUMINTEGER([error code]) : [NSNull null], + @"errorDescription" : error != nil ? [error localizedDescription] : [NSNull null], + @"errorDomain" : error != nil ? [error domain] : [NSNull null] + }]; + }]; +} + @end