-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathDTDevices.h
9589 lines (8778 loc) · 404 KB
/
DTDevices.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#define BTLE_USED
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#ifdef BTLE_USED
#import <CoreBluetooth/CoreBluetooth.h>
#endif
//backward compatibility defines
#define buttonPressed lineaButtonPressed
#define buttonReleased lineaButtonReleased
#define btmSetEnabled btSetEnabled
#define btmGetEnabled btGetEnabled
#define btmWrite btWrite
#define btmRead btRead
#define btmReadLine btReadLine
#define btmGetLocalName btGetLocalName
#define prnDiscoverPrinters btDiscoverPrinters
#define prnDiscoverPrintersInBackground btDiscoverPrintersInBackground
#define barcodeEngineSetInitString barcodeOpticonSetInitString
#define msStartScan msEnable
#define msStopScan msDisable
#define setMSCardDataMode msSetCardDataMode
#define getMSCardDataMode msGetCardDataMode
#define startScan barcodeStartScan
#define stopScan barcodeStopScan
#define getScanTimeout barcodeGetScanTimeout
#define setScanTimeout barcodeSetScanTimeout
#define getScanButtonMode barcodeGetScanButtonMode
#define setScanButtonMode barcodeSetScanButtonMode
#define setScanBeep barcodeSetScanBeep
#define getScanMode barcodeGetScanMode
#define setScanMode barcodeSetScanMode
#define enableBarcode barcodeEnableBarcode
#define isBarcodeEnabled barcodeIsBarcodeEnabled
#define isBarcodeSupported barcodeIsBarcodeSupported
#define getBarcodeTypeMode barcodeGetTypeMode
#define setBarcodeTypeMode barcodeSetTypeMode
#define cryptoRawAuthenticateLinea cryptoRawAuthenticateDevice
#define cryptoRawAuthenticateiPod cryptoRawAuthenticateHost
#define cryptoAuthenticateLinea cryptoAuthenticateDevice
#define cryptoAuthenticateiPod cryptoAuthenticateHost
#define btConnectPrinter btConnectSupportedDevice
#define pinGetPINBlockUsingDUKPT ppadGetPINBlockUsingDUKPT
#define iso14ATranscieve iso14Transceive
#define iso14BTranscieve iso14Transceive
#define emv2LoadConfigurationData emv2LoadContactlessConfiguration
#define prnLoadLogo uiLoadLogo
/**
* Device type
*/
typedef NS_ENUM(int, SUPPORTED_DEVICE_TYPES)
{
/**
Linea Pro 1,2,3,4,4s, LineaTab
*/
DEVICE_TYPE_LINEA=0,
/**
Any of the supported printers - PP-60, DPP-250, DPP-350, DPP-450
*/
DEVICE_TYPE_PRINTER,
/**
Any of the supported pinpads - MPED-400, PPAD1, BP50, BP500
*/
DEVICE_TYPE_PINPAD,
/**
Transport device for connecting to other devices via bluetooth
*/
DEVICE_TYPE_ISERIAL,
/**
Any of the supported zebra printers - DPP-450
*/
DEVICE_TYPE_PRINTER_ZPL,
/**
Any of the supported iHUB devices
*/
DEVICE_TYPE_IHUB,
/**
Any of the supported HID barcode devices
*/
DEVICE_TYPE_HID_BARCODE,
};
#ifndef IHUB_DEFINED
#define IHUB_DEFINED
/**
* iHUB RS232 Port Stop Bits
*/
typedef NS_ENUM(int, IHUB_RS232_STOPBITS)
{
/**
1 stop bit
*/
IHUB_RS232_STOPBITS_1=0x01,
/**
2 stop bits
*/
IHUB_RS232_STOPBITS_2,
/**
1.5 stop bits
*/
IHUB_RS232_STOPBITS_15,
/**
3 stop bits
*/
IHUB_RS232_STOPBITS_3,
};
/**
* iHUB RS232 Port Parity
*/
typedef NS_ENUM(int, IHUB_RS232_PARITY)
{
/**
Parity: none
*/
IHUB_RS232_PARITY_NONE=0x00,
/**
Parity: odd
*/
IHUB_RS232_PARITY_ODD,
/**
Parity: even
*/
IHUB_RS232_PARITY_EVEN,
};
/**
* iHUB RS232 Port Flow Control
*/
typedef NS_ENUM(int, IHUB_RS232_FLOW)
{
/**
Flow control: none
*/
IHUB_RS232_FLOW_NONE=0x00,
/**
Flow control: RTS/CTS
*/
IHUB_RS232_FLOW_RTSCTS,
/**
Flow control: DTR/DSR
*/
IHUB_RS232_FLOW_DTRDSR,
};
/**
* iHUB Port Types
*/
typedef NS_ENUM(int, IHUB_PORT_TYPE)
{
/**
Port type RS232
*/
IHUB_PORT_TYPE_USB=0x01,
/**
Port type USB
*/
IHUB_PORT_TYPE_RS232=0x02,
};
/**
* iHUB Port Status
*/
typedef NS_ENUM(int, IHUB_PORT_STATUS)
{
/**
Port is disconnected
*/
IHUB_PORT_STATUS_DISCONNECTED=0x00,
/**
Port has device connected
*/
IHUB_PORT_STATUS_CONNECTED,
/**
Port status is unknown
*/
IHUB_PORT_STATUS_UNKNOWN,
/**
Port is in error state, i.e. overcurrent protectiona activated
*/
IHUB_PORT_STATUS_ERROR,
};
/**
Provides information about available ports on the device
*/
@interface iHUBPortInfo : NSObject
/**
Port index, from 0 to available ports
*/
@property (assign) int portIndex;
/**
Port type, serial or usb
*/
@property (assign) IHUB_PORT_TYPE portType;
/**
Port status - availabe, connected or in error state
*/
@property (assign) IHUB_PORT_STATUS portStatus;
/**
Port configuration - either empty string or one of the port constants
*/
@property (copy) NSString *portConfig;
@end
/**
Generic iHUB device class delegate calls
*/
@protocol iHUBDeviceDelegate
-(void)dataReceived:(NSData *)data;
-(void)portStatusChanged:(IHUB_PORT_STATUS)newStatus;
@end
@interface iHUBUSBDeviceDescriptor : NSObject
@property (assign) uint16_t bcdUSB;// 2 BCD USB Specification Number which device complies too.
@property (assign) uint8_t bDeviceClass;// 1 Class Class Code (Assigned by USB Org) If equal to Zero, each interface specifies it’s own class code If equal to 0xFF, the class code is vendor specified. Otherwise field is valid Class Code.
@property (assign) uint8_t bDeviceSubClass;// 1 SubClass Subclass Code (Assigned by USB Org)
@property (assign) uint8_t bDeviceProtocol;// 1 Protocol Protocol Code (Assigned by USB Org)
@property (assign) uint8_t bMaxPacketSize;// 1 Number Maximum Packet Size for Zero Endpoint. Valid Sizes are 8, 16, 32, 64
@property (assign) uint16_t idVendor;// 2 ID Vendor ID (Assigned by USB Org)
@property (assign) uint16_t idProduct;// 2 ID Product ID (Assigned by Manufacturer)
@property (assign) uint16_t bcdDevice;// 2 BCD Device Release Number
@property (copy) NSString *iManufacturer;// 1 Index Index of Manufacturer String Descriptor
@property (copy) NSString *iProduct;// 1 Index Index of Product String Descriptor
@property (copy) NSString *iSerialNumber;// 1 Index Index of Serial Number String Descriptor
@property (assign) uint8_t bNumConfigurations;// 1 Integer Number of Possible Configurations
@end
/**
Generic iHUB device class
*/
@interface iHUBDevice : NSObject
/**
Control delegate
*/
@property (assign) id delegate;
/**
Port index, from 0 to available ports
*/
@property (assign) int portIndex;
/**
Port type, serial or usb
*/
@property (assign) IHUB_PORT_TYPE portType;
/**
Port status - availabe, connected or in error state
*/
@property (assign) IHUB_PORT_STATUS portStatus;
/**
Port configuration - either empty string or one of the port constants
*/
@property (copy) NSString *portConfig;
-(NSData *)readData:(int)maxBytes timeout:(NSTimeInterval)timeout error:(NSError **)error;
-(int)writeData:(NSData *)data timeout:(NSTimeInterval)timeout error:(NSError **)error;
@end
/**
iHUB RS232 device class
*/
@interface iHUBRS232Device : iHUBDevice
-(BOOL)setRS232ConfigWithBaud:(int)baud dataBits:(int)dataBits stopBits:(IHUB_RS232_STOPBITS)stopBits parity:(IHUB_RS232_PARITY)parity flowControl:(IHUB_RS232_FLOW)flowControl error:(NSError **)error;
@end
#endif
/**
Information about financial card
*/
@interface DTFinancialCardInfo : NSObject
/**
Cardholder name or empty if unavailable
*/
@property (copy) NSString *cardholderName;
/**
Cardholder first name or empty if unavailable
*/
@property (copy) NSString *cardholderFirstName;
/**
Cardholder last name or empty if unavailable
*/
@property (copy) NSString *cardholderLastName;
/**
Primary account number
*/
@property (copy) NSString *accountNumber;
/**
Service code or empty if unavailable
*/
@property (copy) NSString *serviceCode;
/**
Discretionary data or empty if unavailable
*/
@property (copy) NSString *discretionaryData;
/**
Expiration date: month
*/
@property (assign) int expirationMonth;
/**
Expiration date: year
*/
@property (assign) int expirationYear;
@end
/**
* PIN Reading mode
*/
typedef NS_ENUM(int, EMV_PIN_ENTRY)
{
/**
Automatic, default value - the kernel will ask for pin if the card requires it and the terminal capabilities indicate that pin is supported
*/
PIN_ENTRY_AUTOMATIC=0,
/**
Always asks for pin entry regardless of the card status
*/
PIN_ENTRY_ENABLED,
/**
Never asks for pin entry regardless of the card status
*/
PIN_ENTRY_DISABLED,
};
/**
D slots
*/
typedef NS_ENUM(int, CERTIFICATE_SLOTS)
{
/**
Data root certificate
*/
CERT_SLOT_DATA_ROOT=0,
/**
Intermediate key certificate, signed with root certificate
*/
CERT_SLOT_DATA_INTERMEDIATE,
/**
Encryption key certificate, signed with either root certificate or intermediate certificate
*/
CERT_SLOT_DATA_KEY,
/**
Parameter encryption key certificate
*/
CERT_SLOT_PARAMS,
};
@interface DTCertificateInfo : NSObject
@property (assign) int slot;
@property (assign) uint32_t version;
@property (assign) uint32_t usage;
@end
/**
Transaction or reading failed
*/
#define REASON_FAILED 0
/**
Transaction timed out
*/
#define REASON_TIMEOUT 1
/**
User canceled the transaction
*/
#define REASON_CANCELED 2
/**
Customer's card is blocked
*/
#define REASON_CARD_BLOCKED 3
/**
Double tap transaction
*/
#define REASON_DOUBLE_TAP_TRANSACTION 4
/**
Card read failure
*/
#define REASON_CARD_READ_FAILED 99
#ifndef STRUCTURES_DEFINED
#define STRUCTURES_DEFINED
/**
Describes led control state, for example for making led 0 blink every second with 500ms on and 500ms off, then set period to 500, numBits to 2 and bitmask to 0x00000002
*/
typedef struct
{
/**
LED number starting from 0, 31 is defined for the backlight
*/
uint ledNumber;
/**
Time period in milliseconds
*/
uint periodMS;
/**
The number of control bits, i.e. if you define 2, then the first 2 bits (0 and 1) of the bitmask will be used for changing the state
*/
uint numBits;
/**
Bitmask of the led state, each led bit defines led/backlight state as 1 for on, 0 for off and keeps it in this state for "periodMS" milliseconds
*/
uint bitMask;
}LEDControl;
typedef NS_ENUM(int, BARCODES)
{
BAR_ALL=0,
BAR_UPC,
BAR_CODABAR,
BAR_CODE25_NI2OF5,
BAR_CODE25_I2OF5,
BAR_CODE39,
BAR_CODE93,
BAR_CODE128,
BAR_CODE11,
BAR_CPCBINARY,
BAR_DUN14,
BAR_EAN2,
BAR_EAN5,
BAR_EAN8,
BAR_EAN13,
BAR_EAN128,
BAR_GS1DATABAR,
BAR_ITF14,
BAR_LATENT_IMAGE,
BAR_PHARMACODE,
BAR_PLANET,
BAR_POSTNET,
BAR_INTELLIGENT_MAIL,
BAR_MSI,
BAR_POSTBAR,
BAR_RM4SCC,
BAR_TELEPEN,
BAR_PLESSEY,
BAR_PDF417,
BAR_MICROPDF417,
BAR_DATAMATRIX,
BAR_AZTEK,
BAR_QRCODE,
BAR_MAXICODE,
BAR_LAST
};
typedef NS_ENUM(int, BARCODES_EX)
{
BAR_EX_ALL=0,
BAR_EX_UPCA,
BAR_EX_CODABAR,
BAR_EX_CODE25_NI2OF5,
BAR_EX_CODE25_I2OF5,
BAR_EX_CODE39,
BAR_EX_CODE93,
BAR_EX_CODE128,
BAR_EX_CODE11,
BAR_EX_CPCBINARY,
BAR_EX_DUN14,
BAR_EX_EAN2,
BAR_EX_EAN5,
BAR_EX_EAN8,
BAR_EX_EAN13,
BAR_EX_EAN128,
BAR_EX_GS1DATABAR,
BAR_EX_ITF14,
BAR_EX_LATENT_IMAGE,
BAR_EX_PHARMACODE,
BAR_EX_PLANET,
BAR_EX_POSTNET,
BAR_EX_INTELLIGENT_MAIL,
BAR_EX_MSI_PLESSEY,
BAR_EX_POSTBAR,
BAR_EX_RM4SCC,
BAR_EX_TELEPEN,
BAR_EX_UK_PLESSEY,
BAR_EX_PDF417,
BAR_EX_MICROPDF417,
BAR_EX_DATAMATRIX,
BAR_EX_AZTEK,
BAR_EX_QRCODE,
BAR_EX_MAXICODE,
BAR_EX_RESERVED1,
BAR_EX_RESERVED2,
BAR_EX_RESERVED3,
BAR_EX_RESERVED4,
BAR_EX_RESERVED5,
BAR_EX_UPCA_2,
BAR_EX_UPCA_5,
BAR_EX_UPCE,
BAR_EX_UPCE_2,
BAR_EX_UPCE_5,
BAR_EX_EAN13_2,
BAR_EX_EAN13_5,
BAR_EX_EAN8_2,
BAR_EX_EAN8_5,
BAR_EX_CODE39_FULL,
BAR_EX_ITA_PHARMA,
BAR_EX_CODABAR_ABC,
BAR_EX_CODABAR_CX,
BAR_EX_SCODE,
BAR_EX_MATRIX_2OF5,
BAR_EX_IATA,
BAR_EX_KOREAN_POSTAL,
BAR_EX_CCA,
BAR_EX_CCB,
BAR_EX_CCC,
BAR_EX_LAST
};
/**
* Connection state
*/
typedef NS_ENUM(int, CONN_STATES)
{
/**
Device is disconnected, no automatic connection attempts will be made
*/
CONN_DISCONNECTED,
/**
The SDK is trying to connect to the device
*/
CONN_CONNECTING,
/**
Device is connected
*/
CONN_CONNECTED
};
/**
* Device connection types
*/
typedef NS_ENUM(int, DEVICE_CONNECTION_TYPE)
{
/**
Accessory connection, this includes devices connected via the connector on the iOS device and bluetooth devices that use iOS's bluetooth preferences to connect to
*/
CONNECTION_ACCESSORY,
/**
TCP/IP connection (WiFi)
*/
CONNECTION_TCPIP,
/**
Bluetooth connection - this is raw bluetooth connection, done via some other device's bluetooth module, it includes Linea and iSerial's bluetooth modules being used to connect to a printer for example
*/
CONNECTION_BLUETOOTH,
/**
Bluetooht Low Energy connection
*/
CONNECTION_BLUETOOTHLE
};
/**
Filtering bluetooth devices to discover
*/
typedef NS_ENUM(int, BLUETOOTH_FILTER)
{
/**
Include all supported devices (default)
*/
BLUETOOTH_FILTER_ALL=-1,
/**
Include supported printers
*/
BLUETOOTH_FILTER_PRINTERS=1,
/**
Include supported pinpads
*/
BLUETOOTH_FILTER_PINPADS=2,
/**
Include supported barcode scanners
*/
BLUETOOTH_FILTER_BARCODE_SCANNERS=4,
};
#ifndef DSCAN_MODES
#define DSCAN_MODES
/**
Barcode scan modes
*/
typedef NS_ENUM(int, SCAN_MODES)
{
/**
The scan will be terminated after successful barcode recognition (default)
*/
MODE_SINGLE_SCAN=0,
/**
Scanning will continue unless either scan button is releasd, or stop scan function is called
*/
MODE_MULTI_SCAN,
/**
For as long as scan button is pressed or stop scan is not called the engine will operate in low power scan mode trying to detect objects entering the area, then will turn on the lights and try to read the barcode. Supported only on Code engine.
*/
MODE_MOTION_DETECT,
/**
Pressing the button/start scan will enter aim mode, while a barcode scan will actually be performed upon button release/stop scan.
*/
MODE_SINGLE_SCAN_RELEASE,
/**
Same as multi scan mode, but allowing no duplicate barcodes to be scanned
*/
MODE_MULTI_SCAN_NO_DUPLICATES,
};
#endif //SCAN_MODES
/**
Button modes
*/
typedef NS_ENUM(int, BUTTON_STATES)
{
/**
Button is disabled
*/
BUTTON_DISABLED=0,
/**
Button is enabled (default)
*/
BUTTON_ENABLED
};
/**
Settings button modes
*/
typedef NS_ENUM(int, SETTINGS_BUTTON_STATES)
{
/**
Button is enabled in all states (default)
*/
SETTINGS_BUTTON_ENABLED=0,
/**
Button is enabled only when device is powering on (hold it)
*/
SETTINGS_BUTTON_POWER_ON=1,
};
/**
Card data mode
*/
typedef NS_ENUM(int, MS_MODES)
{
/**
Card data is processed and tracks are extracted (default)
*/
MS_PROCESSED_CARD_DATA=0,
/**
Card data will be returned as RAW sequence of bits
*/
MS_RAW_CARD_DATA=1,
/**
Card data will be returned as processed, but only track 2 will be read
*/
MS_PROCESSED_TRACK2_DATA=3,
};
/**
Trans Armor card reading/encryption modes
*/
typedef NS_ENUM(int, TA_MODES)
{
/**
Result data contains both T1 and T2 in single RSA packet
*/
TA_MODE_T1T2_COMBINED=0,
/**
Result data contains single RSA packet, Track1 only
*/
TA_MODE_T1_ONLY,
/**
Result data contains single RSA packet, Track2 only
*/
TA_MODE_T2_ONLY,
/**
Result data contains single RSA packet per track
*/
TA_MODE_T1T2_SEPARATE,
/**
Result data contains single RSA packet, PAN only
*/
TA_MODE_PAN_ONLY,
};
/**
EMV Level 2 kernel types
*/
typedef NS_ENUM(int, FEAT_EMV2_KERNELS)
{
/**
NecomPlus kernel found in the pinpads
*/
EMV_KERNEL_NECOMPLUS=1,
/**
Datecs EMV L2 kernel
*/
EMV_KERNEL_DATECS=2,
/**
Datecs EMV L2 Universal kernel, check attached pdf for configuration description
*/
EMV_KERNEL_UNIVERSAL=4,
};
/**
EMV Level 2 kernel types
*/
typedef NS_ENUM(int, EMV2_INTERFACES)
{
/**
Contact SmartCard interface
*/
EMV_INTERFACE_CONTACT=1,
/**
Contactless interface
*/
EMV_INTERFACE_CONTACTLESS=2,
/**
Contact Magnetic Card interface
*/
EMV_INTERFACE_MAGNETIC=4,
/**
Manual Magnetic Card Entry interface
*/
EMV_INTERFACE_MAGNETIC_MANUAL=8,
};
#ifndef DBARCODE_TYPES
#define DBARCODE_TYPES
/**
The way to return barcode types
*/
typedef NS_ENUM(int, BARCODE_TYPES)
{
/**
Barcode types are returned from the BAR_* list (default)
*/
BARCODE_TYPE_DEFAULT=0,
/**
Barcode types are returned from the extended barcode list - BAR_EX_*
*/
BARCODE_TYPE_EXTENDED,
/**
Barcode types are returned as ISO 15424 format
*/
BARCODE_TYPE_ISO15424
};
#endif //DBARCODE_TYPES
/**
Firmware update phases
*/
typedef NS_ENUM(int, UPDATE_PHASES)
{
/**
Initializing update
*/
UPDATE_INIT=0,
/**
Erasing old firmware/preparing memory
*/
UPDATE_ERASE,
/**
Writing data
*/
UPDATE_WRITE,
/**
Update complete, this is the final phase
*/
UPDATE_FINISH,
/**
Post-update operations
*/
UPDATE_COMPLETING
};
/** @defgroup G_SCAPDUENCRYPTIONS SmartCard APDU Encryption Algorithms
Supported encryption algorithms for smartcard apdus
@{
*/
/**
DUKPT encryption algorithm returning the data in:
- Data length inside the encrypted block (2 bytes, MSB), i.e. if only SW1 and SW2 are inside, the length will be 2 while the encrypted block - 8
- Encrypted apdu response (variable, 00 for padding)
- SW1 and SW2 in plain (2 bytes)
- KSN (10 bytes)
*/
#define ALG_APDU_DUKPT 0
/**@}*/
/** @defgroup G_MSENCRYPTIONS Magnetic Card Encryption Algorithms
Supported encryption algorithms for magnetic track data on various devices
@{
*/
/**
AES 256 encryption algorithm
*/
#define ALG_AES256 0
/**
Encrypted Head ECC encryption algorithm
*/
#define ALG_EH_ECC 1
/**
Encrypted Head AES256 encryption algorithm. Encryption type is CBC.
After decryption, the result data will be as follows:
- Random data (4 bytes)
- Device identification text (16 ASCII characters, unused bytes are 0)
- Processed track data in the format: 0xF1 (track1 data), 0xF2 (track2 data) 0xF3 (track3 data). It is possible some of the tracks will be empty, then the identifier will not be present too, for example 0xF1 (track1 data) 0xF3 (track3 data)
- End of track data (byte 0x00)
- CRC16CCIT (2 bytes) - the CRC is performed from the start of the encrypted block (the Random Data block) to the end of the track data (including the 0x00 byte).
The data block is rounded to 16 bytes
*/
#define ALG_EH_AES256 2
/**
Encrypted Head IDTECH encryption algorithm, please refer to IDTECH documentation for detailed format and examples.
Data, that is received via magneticCardEncryptedData has the following format:
- (1 byte) card encoding type, can ignore
- (1 byte) bits marking which track is present
- (1 byte) track 1 UNENCRYPTED length
- (1 byte) track 2 UNENCRYPTED length
- (1 byte) track 3 UNENCRYPTED length
- (track 1 UNENCRYPTED length bytes) track 1 masked data
- (track 2 UNENCRYPTED length bytes) track 2 masked data
- (track 3 UNENCRYPTED length bytes) track 3 masked data
- (variable bytes) Track 1 + Track 2 encrypted data, the length of this block is calculated by substracting from the end
- (20 bytes) track 1 sha1
- (20 bytes) track 2 sha1
- (10 bytes) DUKPT KSN
Encrypted block contents after decryption (3DES):
- (track 1 UNENCRYPTED length bytes) track 1 data
- (track 2 UNENCRYPTED length bytes) track 2 data
DUKPT data key derivation for magtek uses the newest X.24 DUKPT standard, i.e. after XORing the bytes to get the data key, the result key is encrypted
with itself using 3DES ECB.
*/
#define ALG_EH_IDTECH 3
/**
Encrypted Head IDTECH encryption algorithm, please refer to IDTECH documentation for detailed format and examples.
Data, that is received via magneticCardEncryptedData has the following format:
- (1 byte) card encoding type, can ignore
- (1 byte) bits marking which track is present
- (1 byte) track 1 UNENCRYPTED length
- (1 byte) track 2 UNENCRYPTED length
- (1 byte) track 3 UNENCRYPTED length
- (track 1 UNENCRYPTED length bytes) track 1 masked data
- (track 2 UNENCRYPTED length bytes) track 2 masked data
- (track 3 UNENCRYPTED length bytes) track 3 masked data
- (variable bytes) Track 1 + Track 2 encrypted data, the length of this block is calculated by substracting from the end
- (20 bytes) track 1 sha1
- (20 bytes) track 2 sha1
- (10 bytes) DUKPT KSN
Encrypted block contents after decryption (AS128):
- (track 1 UNENCRYPTED length bytes) track 1 data
- (track 2 UNENCRYPTED length bytes) track 2 data
With AES128 version, the normal 3DES DUKPT keys are used, but the encryption algorithm is AES128
*/
#define ALG_EH_IDTECH_AES128 0x0b
/**
Encrypted Head MAGTEK encryption algorithm, please refer to MAGTEK/MAGNASAFE documentation for detailed format and examples.
Data, that is received via magneticCardEncryptedData has the following format:
- (1 byte) card encoding type, can ignore
- (1 byte) bits marking which track is present
- (1 byte) track 1 UNENCRYPTED length
- (1 byte) track 2 UNENCRYPTED length
- (1 byte) track 3 UNENCRYPTED length
- (track 1 UNENCRYPTED length bytes) track 1 masked data
- (track 2 UNENCRYPTED length bytes) track 2 masked data
- (track 3 UNENCRYPTED length bytes) track 3 masked data
- (variable bytes) Track 1 encrypted data, the length of this block is calculated by the unencrypted len, padded to 8 bytes (i.e. if unencrypted was 12 bytes, encrypted will be 16)
- (variable bytes) Track 2 encrypted data, the length of this block is calculated by the unencrypted len, padded to 8 bytes (i.e. if unencrypted was 12 bytes, encrypted will be 16)
- (20 bytes) track 1 sha1
- (20 bytes) track 2 sha1
- (10 bytes) DUKPT KSN
Encrypted block contents after decryption (3DES):
- (track 1 UNENCRYPTED length bytes) track 1 data
- (track 2 UNENCRYPTED length bytes) track 2 data
DUKPT data key derivation for magtek uses the older X.24 DUKPT standard, there is no encryption of the data key by itself after XOR
*/
#define ALG_EH_MAGTEK 4
/**
Encrypted Head MAGTEK encryption algorithm, please refer to MAGTEK/MAGNASAFE documentation for detailed format and examples.
Data, that is received via magneticCardEncryptedData has the following format:
- (1 byte) card encoding type, can ignore
- (1 byte) bits marking which track is present
- (1 byte) track 1 UNENCRYPTED length
- (1 byte) track 2 UNENCRYPTED length
- (1 byte) track 3 UNENCRYPTED length
- (track 1 UNENCRYPTED length bytes) track 1 masked data
- (track 2 UNENCRYPTED length bytes) track 2 masked data
- (track 3 UNENCRYPTED length bytes) track 3 masked data
- (variable bytes) Track 1 encrypted data, the length of this block is calculated by the unencrypted len, padded to 16 bytes (i.e. if unencrypted was 24 bytes, encrypted will be 32)
- (variable bytes) Track 2 encrypted data, the length of this block is calculated by the unencrypted len, padded to 16 bytes (i.e. if unencrypted was 24 bytes, encrypted will be 32)
- (20 bytes) track 1 sha1
- (20 bytes) track 2 sha1
- (10 bytes) DUKPT KSN
Encrypted block contents after decryption (3DES):
- (track 1 UNENCRYPTED length bytes) track 1 data
- (track 2 UNENCRYPTED length bytes) track 2 data
DUKPT data key derivation for magtek uses the older X.24 DUKPT standard, there is no encryption of the data key by itself after XOR
With AES128 version, the normal 3DES DUKPT keys are used, but the encryption algorithm is AES128
*/
#define ALG_EH_MAGTEK_AES128 0x0c
/**
Encrypted Head 3DES encryption algorithm
*/
#define ALG_EH_3DES 5
/**
Encrypted Head RSA encryption algorithm
*/
#define ALG_EH_RSA_OAEP 6
/**
Pinpad 3DES format, containing:
- random data (4 bytes)
- unique ID (4 bytes) - same ID you have sent to the function
- payload length (2 bytes) - length of the TLV block in BIG ENDIAN
- card data (variable, ends with 0x00), in format 0xF1 [track1] 0xF2 [track2] 0xF3 [track3] (some tracks might me missing, in this case indentifier is missing too)
- crc (2 bytes) - CRC16 CCIT on all the bytes before it
- padding (0-7 bytes) zeroes to pad the packet with
*/
#define ALG_PPAD_3DES_CBC 7
/**
Encrypted Head Voltage encryption algorithm.
<br>The Voltage SecureData Payments consolidated message format is designed to be
self-contained. The data packet provides all the information necessary to enable decryption
at the Host SDK. It is also self-describing, meaning that the recipient can reliably
interpret the contents independent of any other information, even though the specific
data elements may vary between messages.
<br>The message format is strictly text-based and can be transmitted to the Host even via a web form,
because the design deliberately avoids characters and character sequences that may otherwise need
to be escaped in such environments.
<br>The message structure borrows concepts from swipe card Track data specifications,
specifically the use of start and end sentinels, together with an internal field
separator that delimit the contents. These delimiters, particularly the field separator
(|) and end sentinel (~), have been chosen to avoid any possible conflict with
ciphertext values that may be generated using any version of the Voltage
SecureData Payments encryption protocols.
<br>The message structure allows for all currently supported card data element types
(PAN, MID, and Tracks 1, 2 and 3), included in any combination. It is highly flexible,
allowing for additional data elements to be incorporated, or for substantially new
formats defined for future use.
The packet looks like:
_a[FLAGS]|[PAN]|[MID]|[TRACK1]|[TRACK2]|[TRACK3]|[EXP]|[APP]|[ETB]~
Fields:
<table>
<tr><td>"_"</td><td>Start Sentinel (1 char)</td><td>Start of message is always indicated by an underscore.</td></tr>
<tr><td>"a"</td><td>Format Version (1 char)</td><td>Single letter is used to identify the format version.</td></tr>
<tr><td>"nn"</td><td>Header (2 chars hex)</td><td>The header indicates which optional data fields, of those defined in this format version, are included in the message. This comprises two hex digits interpreted as explained in the next section.</td></tr>
<tr><td>"|"</td><td>Field Separator (1 char)</td><td>Vertical pipe is used as a field separator between message elements. A separator is required following the header to allow this to be of variable length.</td></tr>
<tr><td>"Data(1)"</td><td>First Encrypted Data Field (variable)</td><td>One or more encrypted data fields are optionally included in the sequence defined for the format version.</td></tr>
<tr><td>"|"</td><td>Field Separator (1 char)</td><td></td></tr>
<tr><td>"Data(2)"</td><td>Second Encrypted Data Field (variable)</td><td></td></tr>
<tr><td>"|"</td><td>Field Separator (1 char)</td><td></td></tr>
<tr><td>...</td></tr>