import { CloverTransportObserver } from './CloverTransportObserver'; import { ObjectMessageSender } from './ObjectMessageSender'; /** * Clover Transport * * The clover transport facilitates notification distribution * from the device to a list of observers. */ export declare abstract class CloverTransport { protected observers: CloverTransportObserver[]; protected objectMessageSender: ObjectMessageSender; protected ready: Boolean; protected constructor(); /** * @deprecated - see notifyConnected. */ protected notifyDeviceConnected(): void; /** * Notify observers that we are connected. What "connected" means depends on the transport mechanism. * * For network (SNPD) this means that we have connected to the Clover device. * For cloud (CPD) this means that we have connected to the cloud proxy. */ protected notifyConnected(): void; /** * @deprecated - see notifyReady. */ protected notifyDeviceReady(): void; /** * Notify observers that we are ready to send messages. This has different meanings depending on the transport mechanism. * * For network (SNPD) this means that we have connected to and successfully pinged the Clover device. * For cloud (CPD) this means that we have connected to and successfully pinged the cloud proxy. * * This is generally used to indicate that we are clear to initiate the device via a Discovery Request. * * Note: this does not mean the device is ready to take a payment through the SDK, which is solely determined * by the receipt of a Discovery Response (see DefaultCloverDevice.notifyObserversReady). */ protected notifyReady(): void; /** * @deprecated - see notifyDisconnected. */ protected notifyDeviceDisconnected(): void; /** * Notify observers that we are disconnected. What "disconnected" means depends on the transport mechanism. * * For network (SNPD) this means that we have disconnected from the Clover device. * For cloud (CPD) this means that we have disconnected from the cloud proxy. */ protected notifyDisconnected(): void; protected notifyConnectionAttemptComplete(): void; /** * Should be called by subclasses (_super.onMessage) when a message is received * in order to forward to all observers * * @param {string} message - The message we received */ protected onMessage(message: string): void; /** * Send a message * * @param {string} message - the message to send * @return int - status indicator of 0 or -1 where 0 is success and -1 is failure */ abstract sendMessage(message: string): number; /** * Add new observer to receive notifications from the device * * @param {CloverTransportObserver} observer - the observer to notify */ subscribe(observer: CloverTransportObserver): void; /** * Remove an observer from the list of observers * * @param {CloverTransportObserver} observer - the observer to remove */ unsubscribe(observer: CloverTransportObserver): void; /** * Clear the observers list */ clearListeners(): void; setObjectMessageSender(objectMessageSender: ObjectMessageSender): void; /** * Initializes this transport. */ abstract initialize(): void; /** * Properly dispose of this object */ abstract dispose(): void; /** * Has the transport been shutdown? */ abstract isShutdown(): boolean; /** * Request a disconnect then reconnect */ abstract reset(): void; }