fleeta-api-lib
Version:
A comprehensive library for fleet management applications - API, Auth, Device management
61 lines • 1.73 kB
TypeScript
/**
* GPS Connection State Machine
* Manages GPS WebSocket connection state transitions
*/
/**
* GPS connection states
*/
export type GpsConnectionState = 'idle' | 'connecting' | 'connected' | 'reconnecting' | 'disconnected' | 'failed';
/**
* GPS connection events
*/
export type GpsConnectionEvent = 'CONNECT' | 'CONNECTION_ESTABLISHED' | 'CONNECTION_LOST' | 'RECONNECT_ATTEMPT' | 'DISCONNECT' | 'FAILURE' | 'RESET';
/**
* GPS Connection State Machine class
* Ensures valid state transitions for GPS WebSocket connections
*/
export declare class GpsConnectionStateMachine {
private currentState;
private transitions;
private callbacks;
/**
* Get current state
*/
getState(): GpsConnectionState;
/**
* Check if transition is valid
*/
canTransition(event: GpsConnectionEvent): boolean;
/**
* Execute state transition
*/
transition(event: GpsConnectionEvent): boolean;
/**
* Set state change callbacks
*/
setCallbacks(callbacks: {
onStateChange?: (newState: GpsConnectionState, previousState: GpsConnectionState, event: GpsConnectionEvent) => void;
onInvalidTransition?: (currentState: GpsConnectionState, event: GpsConnectionEvent) => void;
}): void;
/**
* Reset to idle state
*/
reset(): void;
/**
* Check if currently connected
*/
isConnected(): boolean;
/**
* Check if currently connecting or reconnecting
*/
isConnecting(): boolean;
/**
* Check if in error state
*/
hasFailed(): boolean;
/**
* Get human-readable state description
*/
getStateDescription(): string;
}
//# sourceMappingURL=GpsConnectionStateMachine.d.ts.map