EasyScript

This class parses the signatures or swipe cards or both and returns the coordinates of signature or info on the cards.

package

Application

Methods

Constructor, creates a new instance of EasyScript class.

__construct(\com\scriptel\STNSignatureProtocolsignatureProtocol = false, \com\scriptel\STNCardSwipeProtocolcardProtocol = false) : mixed

Arguments

signatureProtocol

\com\scriptel\STNSignatureProtocol

Protocol for the device you're trying to decode signatures for.

cardProtocol

\com\scriptel\STNCardSwipeProtocol

Protocol for the device you're trying to decode card swipes for.

Response

mixed

Adds the listener to the list of listeners.

addListener(\com\scriptel\EasyScriptEventListenercr) : mixed

Arguments

cr

\com\scriptel\EasyScriptEventListener

Response

mixed

Initialize the instance variables.

clearBuffers() : mixed

Response

mixed

Returns a list of event listeners.

getEventListeners() : \com\scriptel\EasyScriptEventListener[]

Response

\com\scriptel\EasyScriptEventListener[]

The state in which the signature is interrupted.

interruptedSignature(stringchr) : mixed

Arguments

chr

string

Current character in the stream.

Response

mixed

This method takes an EasyScript string and attempts to to parse it into a Signature or a CardSwipe object.

parse(stringsig) : \com\scriptel\Signature
Throws
\com\scriptel\SignatureInvalidException

Arguments

sig

string

The signature or card swipe data that would be decoded.

Response

\com\scriptel\Signature

| CardSwipe

This method parses the card swipe.

parseCard(stringchr) : \com\scriptel\EasyScriptCardState

Arguments

chr

string

Current character in the stream.

Response

\com\scriptel\EasyScriptCardState

This method attempts to parse a magnetic card swipe from a ScripTouch device with a magnetic strip reader.

parseCardSwipe(stringswipe) : \com\scriptel\CardSwipe
Throws
\com\scriptel\CardSwipeInvalidException

Thrown in the event the card couldn't be properly parsed.

Arguments

swipe

string

ScripTouch magnetic strip data.

Response

\com\scriptel\CardSwipe

Parsed card swipe.

This method allows you to stream in a set of characters and the library 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 addListener() prior to passing characters to this function.

parseCharacter(stringchr) : mixed

This listener will be called when specific events are generated by decoding the stream.

Throws
\com\scriptel\SignatureInvalidException

Thrown in the event an unexpected condition occurs while parsing the stream.

Arguments

chr

string

Next character in the stream to parse.

Response

mixed

Removes a listener from the list of listeners.

removeListener(\com\scriptel\EasyScriptEventListenercr) : mixed

Arguments

cr

\com\scriptel\EasyScriptEventListener

Response

mixed

The state in which the signature is compressed.

signatureCompressedState(stringchr) : mixed
var

EasyScriptEventListener

Arguments

chr

string

Current character in the stream.

Response

mixed

Transitions from SIGNATURE_SENTINEL state to PROTOCOL_VERSION state.

tranistionFromSignatureSentinelToProtocolVersion(stringchr) : mixed
Throws
\com\scriptel\SignatureInvalidException

Arguments

chr

string

Current character in the stream.

Response

mixed

Transitions from CARD_SENTINEL state to CARD_DATA state.

transitionFromCardSentinelToData(\com\scriptel\EasyScriptCardStatestate) : mixed

Arguments

state

\com\scriptel\EasyScriptCardState

Final state of the card.

Response

mixed

Transitions from FIRMWARE_VERSION to SIGNATURE_UNCOMPRESSED or SIGNATURE_COMPRESSED.

transitionFromFirmwareVersionToSignature(stringchr) : mixed
var

EasyScriptEventListener

Throws
\com\scriptel\SignatureInvalidException

Arguments

chr

string

Current character in the stream.

Response

mixed

Transitions from MODEL state to FIRMWARE_VERSION state.

transitionFromModelToFirmwareVersion(stringchr) : mixed

Arguments

chr

string

Current character in the stream.

Response

mixed

Transitions from PROTOCOL_VERSION state to MODEL state.

transitionFromProtocolVersionToModel(stringchr) : mixed

Arguments

chr

string

Current character in the stream.

Response

mixed

Transitions from UNKNOWN state to SIGNATURE_SENTINEL state or CARD_SENTINEL state.

transitionFromUnknownToSentinel(stringchr) : mixed

Arguments

chr

string

Current character in the stream.

Response

mixed

Constants

This contains the current version of the library.

LIBRARY_VERSION

This contains the date on which the library was built (YYYY-MM-DD HH:MM:SS).

LIBRARY_BUILD_DATE

Properties

The protocol by which to decode the incoming signature strings.

signatureProtocol : 
var

SignatureProtocol.

This is the protocol by which we'll decode incoming card swipe strings.

cardProtocol : \com\scriptel\CardSwipeProtocol
var

Type(s)

CardSwipeProtocol

Keeps track of the current card state.

cardState : 
var

EasyScriptCardState.

Contains the incoming signature.

signatureBuffer : string
var

Type(s)

string

Keeps a card buffer we'll use to check to make sure we're looking at a card.

cardBuffer : string
var

Type(s)

string

An instance EasyScriptDecoder interface.

decoder : \com\scriptel\EasyScriptDecoder
var

Type(s)

EasyScriptDecoder

A list of Coordinate Listeners.

eventListeners : \com\scriptel\EasyScriptEventListener[]
var

Type(s)

array<string|int, EasyScriptEventListener>

The curent position in the stream.

currentPosition : int
var

Type(s)

int

The current state of the streaming parser.

currentState : \com\scriptel\EasyScriptStreamingState