EasyScript C API  3.5.29
Platform Independent C Library for EasyScript ScripTouch Devices
scriptel-easyscript.h File Reference
#include <time.h>
Include dependency graph for scriptel-easyscript.h:

Go to the source code of this file.

Data Structures

struct  scriptel_signature_protocol
 This structure contains information about a signature protocol that can be used to decode a signature buffer. More...
 
struct  scriptel_cardswipe_protocol
 This structure contains information about a card swipe protocol that can be used to decode a card swipe buffer. More...
 
struct  scriptel_financial_track_one
 This structure represents the first track of a financial card. More...
 
struct  scriptel_financial_track_two
 This structure represents the second track of a financial card. More...
 
struct  scriptel_financial_card
 This structure represents a financial card. More...
 
struct  scriptel_identification_track_one
 This structure represents the first track of an identification card. More...
 
struct  scriptel_identification_track_two
 This structure represents track two of an identification card. More...
 
struct  scriptel_identification_track_three
 This structure represents track three of an identification card. More...
 
struct  scriptel_identification_card
 This structure contains information from an identification card. More...
 
struct  scriptel_coordinate
 This structure represents a single coordinate. More...
 
struct  signature_meta_data
 This structure represents a data about the signature that will follow. More...
 
struct  scriptel_cardswipe
 This structure represents a parsed card swipe. More...
 
union  streaming_event_data
 
struct  scriptel_stroke
 This structure represents a stroke which is made up of contingiously connected coordinates. More...
 
struct  scriptel_signature
 This structure represents a signature which is made up up the header information as well as zero or more strokes. More...
 

Macros

#define SCRIPTEL_SYMBOL_EXPORT   extern
 
#define SCRIPTEL_SYMBOL_LINKAGE   extern
 
#define SCRIPTEL_ERROR_MAX_LEN   512
 
#define SCRIPTEL_EASYSCRIPT_LIBRARY_VERSION   = "3.5.29";
 
#define SCRIPTEL_EASYSCRIPT_BUILD_DATE   = "2022-08-30 17:12:23-0400";
 

Enumerations

enum  scriptel_return_status { SCRIPTEL_RETR_ERROR , SCRIPTEL_RETR_SUCCESS }
 This enumeration contains a set of return codes that functions in this library may return. More...
 
enum  scriptel_financial_card_vendor {
  AMERICAN_EXPRESS , DINERS_CLUB , CARTE_BLANCHE , DISCOVER ,
  ENROUTE , JCB , MASTERCARD , VISA ,
  UNKNOWN
}
 This enumeration contains a set of known financial card issuers. More...
 
enum  callback_type {
  CBT_NEWSTROKE , CBT_COORDINATE , CBT_METADATA , CBT_CANCEL ,
  CBT_END_OF_SIGNATURE , CBT_CARD_DATA
}
 

Functions

SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_signature (scriptel_signature_protocol *sig_protocol, scriptel_signature *signature, char *buffer, int len)
 
SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_cardswipe (const scriptel_cardswipe_protocol *swipe_protocol, scriptel_cardswipe *swipe, char *buffer, int len)
 
SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_char (const scriptel_signature_protocol *sig_protocol, char chr)
 
SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_keycode (const scriptel_signature_protocol *sig_protocol, int code, int shift)
 
SCRIPTEL_SYMBOL_LINKAGE const char * scriptel_get_card_issuer_name (scriptel_financial_card_vendor vendor)
 
SCRIPTEL_SYMBOL_LINKAGE char * scriptel_get_last_error ()
 
SCRIPTEL_SYMBOL_LINKAGE void scriptel_print_signature (scriptel_signature *signature)
 
SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_signature (scriptel_signature *signature)
 
SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_cardswipe (scriptel_cardswipe *swipe)
 
SCRIPTEL_SYMBOL_LINKAGE void scriptel_print_cardswipe (scriptel_cardswipe *swipe)
 
SCRIPTEL_SYMBOL_LINKAGE void scriptel_add_event_listener (void(*event_listener)(streaming_event_data *sd))
 
SCRIPTEL_SYMBOL_LINKAGE void scriptel_remove_event_listener (void(*event_listener)(streaming_event_data *sd))
 
SCRIPTEL_SYMBOL_LINKAGE void scriptel_remove_all_event_listeners ()
 
SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_memory ()
 

Variables

static const scriptel_signature_protocol STN_SIGNATURE_PROTOCOL
 The standard signature protocol for the ScripTouch series devices. More...
 
static const scriptel_cardswipe_protocol STN_CARDSWIPE_PROTOCOL
 The standard card swipe protocol for the ScripTouch series devices. More...
 

Macro Definition Documentation

◆ SCRIPTEL_EASYSCRIPT_BUILD_DATE

#define SCRIPTEL_EASYSCRIPT_BUILD_DATE   = "2022-08-30 17:12:23-0400";

The date on which this library was produced. Please don't change this. It is used for support purposes.

◆ SCRIPTEL_EASYSCRIPT_LIBRARY_VERSION

#define SCRIPTEL_EASYSCRIPT_LIBRARY_VERSION   = "3.5.29";

The version number of this EasyScript library. Please don't change this. It is used for support purposes.

◆ SCRIPTEL_ERROR_MAX_LEN

#define SCRIPTEL_ERROR_MAX_LEN   512

Maximum length of any error message.

◆ SCRIPTEL_SYMBOL_EXPORT

#define SCRIPTEL_SYMBOL_EXPORT   extern

This symbol is used to abstract the way in which DLL/shared library symbols are exported. This macro should always resolve to the call/keyword used to export a symbol.

For Linux/OSX this will always resolve to the extern keyword.

◆ SCRIPTEL_SYMBOL_LINKAGE

#define SCRIPTEL_SYMBOL_LINKAGE   extern

This symbol is used to abstract the way in which DLL/shared library symbols are exported. This macro should always resolve to the call/keyword used to produce or consume the shared library symbols. If the SCRIPTEL_EXPORT_DLL preprocessor define is set it should resolve to export, otherwise import.

For Linux/OSX this will always resolve to the extern keyword.

Enumeration Type Documentation

◆ callback_type

A set of constants indicating the type of data being sent to the application

Enumerator
CBT_NEWSTROKE 

notification of a new stroke

CBT_COORDINATE 

new new coordinate

CBT_METADATA 

metadata for the upcoming signature

CBT_CANCEL 

the signature has been cancelled

CBT_END_OF_SIGNATURE 

the end of the signature has been reached succesfully

CBT_CARD_DATA 

card data

◆ scriptel_financial_card_vendor

This enumeration contains a set of known financial card issuers.

Enumerator
AMERICAN_EXPRESS 

American Express

DINERS_CLUB 

Diners Club

CARTE_BLANCHE 

Carte Blanche

DISCOVER 

Discover

ENROUTE 

EnRoute

JCB 

JCB

MASTERCARD 

Master Card

VISA 

Visa

UNKNOWN 

Unknown issuer.

◆ scriptel_return_status

This enumeration contains a set of return codes that functions in this library may return.

Enumerator
SCRIPTEL_RETR_ERROR 

This return code indicates that the last function called did not complete successfully. Call scriptel_get_last_error() to get a more friendly description of what failed.

SCRIPTEL_RETR_SUCCESS 

This return code indicates that the last function call completed successfully.

Function Documentation

◆ scriptel_add_event_listener()

SCRIPTEL_SYMBOL_LINKAGE void scriptel_add_event_listener ( void(*)(streaming_event_data *sd)  event_listener)

This function adds an event listener function. The functions added to this list will be called when an event occurs. If an event handler is added more than once, it will be called more than once.

Parameters
event_listenera function that takes as a parameter a pointer to a streaming_data union.

◆ scriptel_free_cardswipe()

SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_cardswipe ( scriptel_cardswipe swipe)

This function will free a scriptel_meta_data structure and all members inside of it.

Parameters
metadata to be freed.

◆ scriptel_free_memory()

SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_memory ( )

Frees all memory that was allocated during calls. It is not really necessary to call this funcion. Some memory is allocated once and is used statically. This function frees that memory. It will be reallocated, if needed, later.

◆ scriptel_free_signature()

SCRIPTEL_SYMBOL_LINKAGE void scriptel_free_signature ( scriptel_signature signature)

This function will free all allocated members inside of a signature structure. It does not free the signature structure itself. Do not attempt to use the structure after freeing it.

Parameters
signatureSignature to free.

◆ scriptel_get_card_issuer_name()

SCRIPTEL_SYMBOL_LINKAGE const char* scriptel_get_card_issuer_name ( scriptel_financial_card_vendor  vendor)

This method attempts to get the name of a financial card issuer by enumeration member.

Parameters
vendorEnumeration member pointing to card issuer.
Returns
Pointer to the name of the card issuer.

◆ scriptel_get_last_error()

SCRIPTEL_SYMBOL_LINKAGE char * scriptel_get_last_error ( )

This function returns the most recent error generated by this library.

Returns
Most recent error in human readable format.

When a function returns SCRIPTEL_RETR_ERROR this call can be made to get a human readable English string explaining the error.

◆ 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 
)

This function will attempt to parse a character buffer as a card swipe. You are responsible for allocating the scriptel_cardswipe structure as well as freeing the memory when you're done. The contents of the structure can be freed by calling scriptel_free_cardswipe() after this function returns a successful result.

Parameters
swipe_protocolCard swipe protocol to use.
swipeCard swipe structure to fill in.
bufferBuffer to parse.
lenLength of buffer, used for bounds checking.
Returns
SCRIPTEL_RETR_SUCCESS on a successful result, SCRIPTEL_RETR_ERROR if the function fails to parse the card swipe. If the card swipe fails to parse the contents of the passed in structure should be treated as null.

◆ scriptel_keyboard_parse_char()

SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_char ( const scriptel_signature_protocol sig_protocol,
char  chr 
)

This fuction allows you to stream in a set of characters and it will attempt to decode signatures and card swipes as the characters are passed in. To use this method be sure to implement your own EasyScriptEventListener and pass it to scriptel_add_event_listener() prior to passing characters to this function. This listener will be called when specific events are generated by decoding the stream.

Parameters
sig_protocolthe protocol to use to interpret the data
chrNext character in the stream to parse

◆ scriptel_keyboard_parse_keycode()

SCRIPTEL_SYMBOL_LINKAGE scriptel_return_status scriptel_keyboard_parse_keycode ( const scriptel_signature_protocol sig_protocol,
int  code,
int  shift 
)

This fuction allows you to stream in a set of keyboard scancodes and it will attempt to decode signatures and card swipes as the characters are passed in. To use this method be sure to implement your own EasyScriptEventListener and pass it to scriptel_add_event_listener() prior to passing characters to this function. This listener will be called when specific events are generated by decoding the stream.

Parameters
sig_protocolthe protocol to use to interpret the data
codethe scancode of the next keyboard event to process
shift0 if the shift key was not down when the scancode was sent, non-zero if it was

◆ 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 
)

This function will attempt to parse a character buffer as a signature. You are responsible for allocating the scriptel_signature structure as well as freeing the memory when you're done. The contents of the structure can be freed by calling scriptel_free_signature() after this function returns a successful result.

Parameters
sig_protocolSignature protocol to use.
signatureSignature structure to fill in.
bufferNull terminated buffer to parse.
lenLength of buffer, used for bounds checking. The lesser of len and the actual length of the null terminated buffer are used.
Returns
SCRIPTEL_RETR_SUCCESS on a successful result, SCRIPTEL_RETR_ERROR if the function fails to parse the signature. If the signature fails to parse the contents of the passed in structure should be treated as null.

◆ scriptel_print_cardswipe()

SCRIPTEL_SYMBOL_LINKAGE void scriptel_print_cardswipe ( scriptel_cardswipe swipe)

This function is a convinence function used to print out the contents of a card swipe structure.

Parameters
swipeCard swipe to print.

◆ scriptel_print_signature()

SCRIPTEL_SYMBOL_LINKAGE void scriptel_print_signature ( scriptel_signature signature)

This function is a convinence function used to print out the contents of a signature structure.

Parameters
signatureSignature to print.

◆ scriptel_remove_all_event_listeners()

SCRIPTEL_SYMBOL_LINKAGE void scriptel_remove_all_event_listeners ( )

This function removes all event listeners.

◆ scriptel_remove_event_listener()

SCRIPTEL_SYMBOL_LINKAGE void scriptel_remove_event_listener ( void(*)(streaming_event_data *sd)  event_listener)

Removes a listener previously added through scriptel_add_event_listener. If it was never added or was previously removed, the call is ignored. If it was added more than once, it will have to be removed more than once...this function only removes the first instance.

Parameters
event_listenera pointer to a function that was previously added through scriptel_add_event_listener

Variable Documentation

◆ STN_CARDSWIPE_PROTOCOL

const scriptel_cardswipe_protocol STN_CARDSWIPE_PROTOCOL
static
Initial value:
= {
"Standard EasyScript Card Swipe Protocol",
'!',
'\r',
"STCARD"
}

The standard card swipe protocol for the ScripTouch series devices.

◆ STN_SIGNATURE_PROTOCOL

const scriptel_signature_protocol STN_SIGNATURE_PROTOCOL
static
Initial value:
= {
"Standard EasyScript Protocol",
'~',
'`',
'/',
' ',
"STSIGN",
240,
64,
{
{
{0x41,0x43,0x45,0x47,0x49,0x4b,0x4d,0x4f,0x51,0x53,0x55,0x57,0x59,0x21,0x23,0x25,0x26,0x28,0x2b,0x7d,0x22,0x3c,0x00},
{0x42,0x44,0x46,0x48,0x4a,0x4c,0x4e,0x50,0x52,0x54,0x56,0x58,0x5a,0x40,0x24,0x5e,0x2a,0x29,0x5f,0x7b,0x7c,0x3a,0x3e}
}, {
{0x61,0x63,0x65,0x67,0x69,0x6b,0x6d,0x6f,0x71,0x73,0x75,0x77,0x79,0x31,0x33,0x35,0x37,0x39,0x3d,0x5d,0x27,0x2c,0x00},
{0x62,0x64,0x66,0x68,0x6a,0x6c,0x6e,0x70,0x72,0x74,0x76,0x78,0x7a,0x32,0x34,0x36,0x38,0x30,0x2d,0x5b,0x5c,0x3b,0x2e}
}
}
}

The standard signature protocol for the ScripTouch series devices.