| EasyScript C API 3.5.29 Platform Independent C Library for EasyScript ScripTouch Devices

scriptel-easyscript.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * scriptel-easyscript.h - Copyright 2014 - Scriptel Corporation
3 * ----
4 * This header contains the definitions for all of the public structures and
5 * functions for this library.
6 ******************************************************************************/
7
42 //This set of defines is for the Visual C compiler to define exports/imports for
43 //the shared library.
44 #ifndef SCRIPTEL_EASYSCRIPT_H
45 #define SCRIPTEL_EASYSCRIPT_H
46
47 #ifdef _MSC_VER
53 #define SCRIPTEL_SYMBOL_EXPORT __declspec(dllexport)
54 //Check to see if we're producing or consuming the library.
55 #ifdef SCRIPTEL_EXPORT_DLL
62 #define SCRIPTEL_SYMBOL_LINKAGE __declspec(dllexport)
63 #else
70 #define SCRIPTEL_SYMBOL_LINKAGE __declspec(dllimport)
71 #endif
72 #else
80 #define SCRIPTEL_SYMBOL_EXPORT extern
89 #define SCRIPTEL_SYMBOL_LINKAGE extern
90 #endif
91
92 #include <time.h>
93
98 typedef enum {
104 SCRIPTEL_RETR_ERROR,
109 SCRIPTEL_RETR_SUCCESS
110 } scriptel_return_status;
111
115 typedef enum {
119 AMERICAN_EXPRESS,
123 DINERS_CLUB,
127 CARTE_BLANCHE,
131 DISCOVER,
135 ENROUTE,
139 JCB,
143 MASTERCARD,
147 VISA,
151 UNKNOWN
152 } scriptel_financial_card_vendor;
153
158 typedef struct {
162 const char* protocol_name;
166 char start_stream;
170 char end_stream;
174 char cancel;
178 char pen_up;
183 const char* sentinel;
188 int width;
193 int height;
197 const char value_table[2][2][23];
198 } scriptel_signature_protocol;
199
204 typedef struct {
208 char* protocol_name;
212 char start_stream;
216 char end_stream;
221 char* sentinel;
222 } scriptel_cardswipe_protocol;
223
227 typedef struct {
231 char* account_number;
235 char* first_name;
239 char* last_name;
244 time_t expiration;
248 char* service_code;
252 char* discretionary_data;
253 } scriptel_financial_track_one;
254
258 typedef struct {
262 char* account_number;
267 time_t expiration;
271 char* service_code;
275 char* discretionary_data;
276 } scriptel_financial_track_two;
277
281 typedef struct {
282 scriptel_financial_track_one* track_one;
283 scriptel_financial_track_two* track_two;
284 scriptel_financial_card_vendor card_issuer;
285 char number_valid;
286 } scriptel_financial_card;
287
291 typedef struct {
295 char* state;
299 char* city;
303 char* last_name;
307 char* first_name;
311 char* middle_name;
315 char* address;
319 char* discretionary_data;
320 } scriptel_identification_track_one;
321
325 typedef struct {
329 char* issuer_number;
333 char* id_number;
337 time_t expiration;
341 time_t birth_date;
342 } scriptel_identification_track_two;
343
347 typedef struct {
351 int cds_version;
355 int jurisdiction_version;
359 char* zip_code;
363 char* license_class;
367 char* restrictions;
371 char* endorsements;
375 char* sex;
379 char* height;
383 char* weight;
387 char* hair_color;
391 char* eye_color;
392 } scriptel_identification_track_three;
393
397 typedef struct {
398 scriptel_identification_track_one* track_one;
399 scriptel_identification_track_two* track_two;
400 scriptel_identification_track_three* track_three;
401 } scriptel_identification_card;
402
406 typedef enum {
407 CBT_NEWSTROKE,
408 CBT_COORDINATE,
409 CBT_METADATA,
410 CBT_CANCEL,
411 CBT_END_OF_SIGNATURE,
412 CBT_CARD_DATA
413 } callback_type;
414
418 typedef struct {
419 callback_type type;
420 double x;
421 double y;
422 } scriptel_coordinate;
423
427 typedef struct {
428 callback_type type;
429 char *protocol_version;
430 char *model;
431 char *version;
432 } signature_meta_data;
433
437 typedef struct {
438 callback_type type;
439 char* protocol_version;
440 char* card_data;
441 scriptel_financial_card* financial_card;
442 scriptel_identification_card* identification_card;
443 } scriptel_cardswipe;
444
448 typedef union {
449 callback_type type;
450 signature_meta_data meta_data;
451 scriptel_coordinate coordinate;
452 scriptel_cardswipe card_swipe;
453 } streaming_event_data;
454
459 typedef struct {
463 int length;
467 scriptel_coordinate* coordinates;
468 } scriptel_stroke;
469
474 typedef struct {
475 char* protocol_version;
476 char* model;
477 char* version;
478 int length;
479 scriptel_stroke* strokes;
480 int width;
481 int height;
482 } scriptel_signature;
483
487 static const scriptel_signature_protocol STN_SIGNATURE_PROTOCOL = {
488 "Standard EasyScript Protocol",
489 '~',
490 '`',
491 '/',
492 ' ',
493 "STSIGN",
494 240,
495 64,
496 {
497 {
498 {0x41,0x43,0x45,0x47,0x49,0x4b,0x4d,0x4f,0x51,0x53,0x55,0x57,0x59,0x21,0x23,0x25,0x26,0x28,0x2b,0x7d,0x22,0x3c,0x00},
499 {0x42,0x44,0x46,0x48,0x4a,0x4c,0x4e,0x50,0x52,0x54,0x56,0x58,0x5a,0x40,0x24,0x5e,0x2a,0x29,0x5f,0x7b,0x7c,0x3a,0x3e}
500 }, {
501 {0x61,0x63,0x65,0x67,0x69,0x6b,0x6d,0x6f,0x71,0x73,0x75,0x77,0x79,0x31,0x33,0x35,0x37,0x39,0x3d,0x5d,0x27,0x2c,0x00},
502 {0x62,0x64,0x66,0x68,0x6a,0x6c,0x6e,0x70,0x72,0x74,0x76,0x78,0x7a,0x32,0x34,0x36,0x38,0x30,0x2d,0x5b,0x5c,0x3b,0x2e}
503 }
504 }
505 };
506
507
508
512 static const scriptel_cardswipe_protocol STN_CARDSWIPE_PROTOCOL = {
513 "Standard EasyScript Card Swipe Protocol",
514 '!',
515 '\r',
516 "STCARD"
517 };
518
522 #define SCRIPTEL_ERROR_MAX_LEN 512
523
524
529 #define SCRIPTEL_EASYSCRIPT_LIBRARY_VERSION = "3.5.29";
530
535 #define SCRIPTEL_EASYSCRIPT_BUILD_DATE = "2022-08-30 17:12:23-0400";
536
552 SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_signature(scriptel_signature_protocol* sig_protocol, scriptel_signature* signature, char* buffer, int len);
553
568 SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_cardswipe(const scriptel_cardswipe_protocol* swipe_protocol, scriptel_cardswipe* swipe, char* buffer, int len);
569
580 SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_char(const scriptel_signature_protocol* sig_protocol, char chr);
581
593 SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_keycode(const scriptel_signature_protocol* sig_protocol, int code, int shift);
594
601 SCRIPTEL_SYMBOL_LINKAGE const char* scriptel_get_card_issuer_name(scriptel_financial_card_vendor vendor);
602
607 SCRIPTEL_SYMBOL_LINKAGE char* scriptel_get_last_error();
608
614 SCRIPTEL_SYMBOL_LINKAGE void scriptel_print_signature(scriptel_signature* signature);
615
622 SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_signature(scriptel_signature* signature);
623
628 SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_cardswipe(scriptel_cardswipe* swipe);
629
635 SCRIPTEL_SYMBOL_LINKAGE void scriptel_print_cardswipe(scriptel_cardswipe* swipe);
636
643 SCRIPTEL_SYMBOL_LINKAGE void scriptel_add_event_listener(void(*event_listener)(streaming_event_data *sd));
644
651 SCRIPTEL_SYMBOL_LINKAGE void scriptel_remove_event_listener(void(*event_listener)(streaming_event_data *sd));
652
657 SCRIPTEL_SYMBOL_LINKAGE void scriptel_remove_all_event_listeners();
661 SCRIPTEL_SYMBOL_LINKAGE char * scriptel_get_last_error();
662
668 SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_memory();
669
670 #endif
scriptel_free_cardswipe
SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_cardswipe(scriptel_cardswipe *swipe)
scriptel_get_card_issuer_name
SCRIPTEL_SYMBOL_LINKAGE const char * scriptel_get_card_issuer_name(scriptel_financial_card_vendor vendor)
scriptel_remove_event_listener
SCRIPTEL_SYMBOL_LINKAGE void scriptel_remove_event_listener(void(*event_listener)(streaming_event_data *sd))
callback_type
callback_type
Definition: scriptel-easyscript.h:406
CBT_CARD_DATA
@ CBT_CARD_DATA
card data
Definition: scriptel-easyscript.h:412
CBT_CANCEL
@ CBT_CANCEL
the signature has been cancelled
Definition: scriptel-easyscript.h:410
CBT_COORDINATE
@ CBT_COORDINATE
new new coordinate
Definition: scriptel-easyscript.h:408
CBT_NEWSTROKE
@ CBT_NEWSTROKE
notification of a new stroke
Definition: scriptel-easyscript.h:407
CBT_METADATA
@ CBT_METADATA
metadata for the upcoming signature
Definition: scriptel-easyscript.h:409
CBT_END_OF_SIGNATURE
@ CBT_END_OF_SIGNATURE
the end of the signature has been reached succesfully
Definition: scriptel-easyscript.h:411
STN_CARDSWIPE_PROTOCOL
static const scriptel_cardswipe_protocol STN_CARDSWIPE_PROTOCOL
The standard card swipe protocol for the ScripTouch series devices.
Definition: scriptel-easyscript.h:512
scriptel_get_last_error
SCRIPTEL_SYMBOL_LINKAGE char * scriptel_get_last_error()
scriptel_keyboard_parse_signature
SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_signature(scriptel_signature_protocol *sig_protocol, scriptel_signature *signature, char *buffer, int len)
scriptel_print_signature
SCRIPTEL_SYMBOL_LINKAGE void scriptel_print_signature(scriptel_signature *signature)
scriptel_keyboard_parse_keycode
SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_keycode(const scriptel_signature_protocol *sig_protocol, int code, int shift)
scriptel_add_event_listener
SCRIPTEL_SYMBOL_LINKAGE void scriptel_add_event_listener(void(*event_listener)(streaming_event_data *sd))
scriptel_keyboard_parse_cardswipe
SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_cardswipe(const scriptel_cardswipe_protocol *swipe_protocol, scriptel_cardswipe *swipe, char *buffer, int len)
STN_SIGNATURE_PROTOCOL
static const scriptel_signature_protocol STN_SIGNATURE_PROTOCOL
The standard signature protocol for the ScripTouch series devices.
Definition: scriptel-easyscript.h:487
scriptel_keyboard_parse_char
SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_char(const scriptel_signature_protocol *sig_protocol, char chr)
scriptel_return_status
scriptel_return_status
This enumeration contains a set of return codes that functions in this library may return.
Definition: scriptel-easyscript.h:98
SCRIPTEL_RETR_SUCCESS
@ SCRIPTEL_RETR_SUCCESS
Definition: scriptel-easyscript.h:109
SCRIPTEL_RETR_ERROR
@ SCRIPTEL_RETR_ERROR
Definition: scriptel-easyscript.h:104
SCRIPTEL_SYMBOL_LINKAGE
#define SCRIPTEL_SYMBOL_LINKAGE
Definition: scriptel-easyscript.h:89
scriptel_free_memory
SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_memory()
scriptel_free_signature
SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_signature(scriptel_signature *signature)
scriptel_remove_all_event_listeners
SCRIPTEL_SYMBOL_LINKAGE void scriptel_remove_all_event_listeners()
scriptel_financial_card_vendor
scriptel_financial_card_vendor
This enumeration contains a set of known financial card issuers.
Definition: scriptel-easyscript.h:115
DINERS_CLUB
@ DINERS_CLUB
Definition: scriptel-easyscript.h:123
VISA
@ VISA
Definition: scriptel-easyscript.h:147
UNKNOWN
@ UNKNOWN
Definition: scriptel-easyscript.h:151
ENROUTE
@ ENROUTE
Definition: scriptel-easyscript.h:135
AMERICAN_EXPRESS
@ AMERICAN_EXPRESS
Definition: scriptel-easyscript.h:119
CARTE_BLANCHE
@ CARTE_BLANCHE
Definition: scriptel-easyscript.h:127
JCB
@ JCB
Definition: scriptel-easyscript.h:139
MASTERCARD
@ MASTERCARD
Definition: scriptel-easyscript.h:143
DISCOVER
@ DISCOVER
Definition: scriptel-easyscript.h:131
scriptel_print_cardswipe
SCRIPTEL_SYMBOL_LINKAGE void scriptel_print_cardswipe(scriptel_cardswipe *swipe)
scriptel_cardswipe_protocol
This structure contains information about a card swipe protocol that can be used to decode a card swi...
Definition: scriptel-easyscript.h:204
scriptel_cardswipe_protocol::sentinel
char * sentinel
Definition: scriptel-easyscript.h:221
scriptel_cardswipe_protocol::end_stream
char end_stream
Definition: scriptel-easyscript.h:216
scriptel_cardswipe_protocol::start_stream
char start_stream
Definition: scriptel-easyscript.h:212
scriptel_cardswipe_protocol::protocol_name
char * protocol_name
Definition: scriptel-easyscript.h:208
scriptel_cardswipe
This structure represents a parsed card swipe.
Definition: scriptel-easyscript.h:437
scriptel_cardswipe::protocol_version
char * protocol_version
Protocol version that generated this card swipe.
Definition: scriptel-easyscript.h:439
scriptel_cardswipe::identification_card
scriptel_identification_card * identification_card
Identification card information if the card was able to be parsed, null otherwise.
Definition: scriptel-easyscript.h:442
scriptel_cardswipe::card_data
char * card_data
Raw captured card data.
Definition: scriptel-easyscript.h:440
scriptel_cardswipe::financial_card
scriptel_financial_card * financial_card
Financial card information if the card was able to be parsed, null otherwise.
Definition: scriptel-easyscript.h:441
scriptel_cardswipe::type
callback_type type
this will be set to CBT_CARD_DATA
Definition: scriptel-easyscript.h:438
scriptel_coordinate
This structure represents a single coordinate.
Definition: scriptel-easyscript.h:418
scriptel_coordinate::y
double y
The vertical coordinate, between 0 and protocol->height.
Definition: scriptel-easyscript.h:421
scriptel_coordinate::type
callback_type type
this will be set to CBT_COORDINATE
Definition: scriptel-easyscript.h:419
scriptel_coordinate::x
double x
The horizontal coordinate, between 0 and protocol->width.
Definition: scriptel-easyscript.h:420
scriptel_financial_card
This structure represents a financial card.
Definition: scriptel-easyscript.h:281
scriptel_financial_card::card_issuer
scriptel_financial_card_vendor card_issuer
The issuer of the financial card.
Definition: scriptel-easyscript.h:284
scriptel_financial_card::track_one
scriptel_financial_track_one * track_one
Track one of the financial card.
Definition: scriptel-easyscript.h:282
scriptel_financial_card::number_valid
char number_valid
Whether or not the card number is valid per Luhn's algorithm. 1 for valid, 0 for invalid.
Definition: scriptel-easyscript.h:285
scriptel_financial_card::track_two
scriptel_financial_track_two * track_two
Track two of the financial card.
Definition: scriptel-easyscript.h:283
scriptel_financial_track_one
This structure represents the first track of a financial card.
Definition: scriptel-easyscript.h:227
scriptel_financial_track_one::expiration
time_t expiration
Definition: scriptel-easyscript.h:244
scriptel_financial_track_one::last_name
char * last_name
Definition: scriptel-easyscript.h:239
scriptel_financial_track_one::first_name
char * first_name
Definition: scriptel-easyscript.h:235
scriptel_financial_track_one::service_code
char * service_code
Definition: scriptel-easyscript.h:248
scriptel_financial_track_one::account_number
char * account_number
Definition: scriptel-easyscript.h:231
scriptel_financial_track_one::discretionary_data
char * discretionary_data
Definition: scriptel-easyscript.h:252
scriptel_financial_track_two
This structure represents the second track of a financial card.
Definition: scriptel-easyscript.h:258
scriptel_financial_track_two::expiration
time_t expiration
Definition: scriptel-easyscript.h:267
scriptel_financial_track_two::service_code
char * service_code
Definition: scriptel-easyscript.h:271
scriptel_financial_track_two::account_number
char * account_number
Definition: scriptel-easyscript.h:262
scriptel_financial_track_two::discretionary_data
char * discretionary_data
Definition: scriptel-easyscript.h:275
scriptel_identification_card
This structure contains information from an identification card.
Definition: scriptel-easyscript.h:397
scriptel_identification_card::track_one
scriptel_identification_track_one * track_one
Track one of the identification card.
Definition: scriptel-easyscript.h:398
scriptel_identification_card::track_two
scriptel_identification_track_two * track_two
Track two of the identification card.
Definition: scriptel-easyscript.h:399
scriptel_identification_card::track_three
scriptel_identification_track_three * track_three
Track three of the identification card.
Definition: scriptel-easyscript.h:400
scriptel_identification_track_one
This structure represents the first track of an identification card.
Definition: scriptel-easyscript.h:291
scriptel_identification_track_one::city
char * city
Definition: scriptel-easyscript.h:299
scriptel_identification_track_one::middle_name
char * middle_name
Definition: scriptel-easyscript.h:311
scriptel_identification_track_one::last_name
char * last_name
Definition: scriptel-easyscript.h:303
scriptel_identification_track_one::state
char * state
Definition: scriptel-easyscript.h:295
scriptel_identification_track_one::first_name
char * first_name
Definition: scriptel-easyscript.h:307
scriptel_identification_track_one::address
char * address
Definition: scriptel-easyscript.h:315
scriptel_identification_track_one::discretionary_data
char * discretionary_data
Definition: scriptel-easyscript.h:319
scriptel_identification_track_three
This structure represents track three of an identification card.
Definition: scriptel-easyscript.h:347
scriptel_identification_track_three::restrictions
char * restrictions
Definition: scriptel-easyscript.h:367
scriptel_identification_track_three::jurisdiction_version
int jurisdiction_version
Definition: scriptel-easyscript.h:355
scriptel_identification_track_three::hair_color
char * hair_color
Definition: scriptel-easyscript.h:387
scriptel_identification_track_three::endorsements
char * endorsements
Definition: scriptel-easyscript.h:371
scriptel_identification_track_three::zip_code
char * zip_code
Definition: scriptel-easyscript.h:359
scriptel_identification_track_three::weight
char * weight
Definition: scriptel-easyscript.h:383
scriptel_identification_track_three::height
char * height
Definition: scriptel-easyscript.h:379
scriptel_identification_track_three::eye_color
char * eye_color
Definition: scriptel-easyscript.h:391
scriptel_identification_track_three::sex
char * sex
Definition: scriptel-easyscript.h:375
scriptel_identification_track_three::cds_version
int cds_version
Definition: scriptel-easyscript.h:351
scriptel_identification_track_three::license_class
char * license_class
Definition: scriptel-easyscript.h:363
scriptel_identification_track_two
This structure represents track two of an identification card.
Definition: scriptel-easyscript.h:325
scriptel_identification_track_two::birth_date
time_t birth_date
Definition: scriptel-easyscript.h:341
scriptel_identification_track_two::issuer_number
char * issuer_number
Definition: scriptel-easyscript.h:329
scriptel_identification_track_two::expiration
time_t expiration
Definition: scriptel-easyscript.h:337
scriptel_identification_track_two::id_number
char * id_number
Definition: scriptel-easyscript.h:333
scriptel_signature_protocol
This structure contains information about a signature protocol that can be used to decode a signature...
Definition: scriptel-easyscript.h:158
scriptel_signature_protocol::width
int width
Definition: scriptel-easyscript.h:188
scriptel_signature_protocol::end_stream
char end_stream
Definition: scriptel-easyscript.h:170
scriptel_signature_protocol::start_stream
char start_stream
Definition: scriptel-easyscript.h:166
scriptel_signature_protocol::cancel
char cancel
Definition: scriptel-easyscript.h:174
scriptel_signature_protocol::protocol_name
const char * protocol_name
Definition: scriptel-easyscript.h:162
scriptel_signature_protocol::height
int height
Definition: scriptel-easyscript.h:193
scriptel_signature_protocol::pen_up
char pen_up
Definition: scriptel-easyscript.h:178
scriptel_signature_protocol::sentinel
const char * sentinel
Definition: scriptel-easyscript.h:183
scriptel_signature
This structure represents a signature which is made up up the header information as well as zero or m...
Definition: scriptel-easyscript.h:474
scriptel_signature::strokes
scriptel_stroke * strokes
Pointer to the first stroke in the signature.
Definition: scriptel-easyscript.h:479
scriptel_signature::width
int width
Virtual width of the coordinate space (maximum x coordinate).
Definition: scriptel-easyscript.h:480
scriptel_signature::protocol_version
char * protocol_version
The protocol version used to encode/decode this signature.
Definition: scriptel-easyscript.h:475
scriptel_signature::version
char * version
The firmware version of the device used to make this firmware.
Definition: scriptel-easyscript.h:477
scriptel_signature::length
int length
The number of strokes in this signature.
Definition: scriptel-easyscript.h:478
scriptel_signature::height
int height
Virtual height of the coordinate space (maximum y coordinate).
Definition: scriptel-easyscript.h:481
scriptel_signature::model
char * model
The model number of the device used to make this signature.
Definition: scriptel-easyscript.h:476
scriptel_stroke
This structure represents a stroke which is made up of contingiously connected coordinates.
Definition: scriptel-easyscript.h:459
scriptel_stroke::length
int length
Definition: scriptel-easyscript.h:463
scriptel_stroke::coordinates
scriptel_coordinate * coordinates
Definition: scriptel-easyscript.h:467
signature_meta_data
This structure represents a data about the signature that will follow.
Definition: scriptel-easyscript.h:427
signature_meta_data::protocol_version
char * protocol_version
a string comprising the protocol version info
Definition: scriptel-easyscript.h:429
signature_meta_data::version
char * version
a string comprising the firmware version
Definition: scriptel-easyscript.h:431
signature_meta_data::type
callback_type type
this will be set to CBT_METADATA
Definition: scriptel-easyscript.h:428
signature_meta_data::model
char * model
a string comprising the signature pad model
Definition: scriptel-easyscript.h:430
streaming_event_data
Definition: scriptel-easyscript.h:448
streaming_event_data::meta_data
signature_meta_data meta_data
the meta data for the upcoming signature
Definition: scriptel-easyscript.h:450
streaming_event_data::coordinate
scriptel_coordinate coordinate
a signature coordinate
Definition: scriptel-easyscript.h:451
streaming_event_data::card_swipe
scriptel_cardswipe card_swipe
cardswipe information
Definition: scriptel-easyscript.h:452
streaming_event_data::type
callback_type type
the type of data contained
Definition: scriptel-easyscript.h:449