UNPKG

incyclist-ant-plus

Version:

Incyclist library for ANT+ - originally forked from longhorn/ant-plus

39 lines (38 loc) 1.27 kB
import { ChildProcess } from "child_process"; import { IAntDevice, AntDeviceProps } from "../types"; import { AntDevice } from "../ant-device"; export interface AntServerDeviceProps extends AntDeviceProps { binaryPath?: string; serverDebug?: boolean; } export type RequestInfo = { message: any; resolve: any; reject: any; }; export type Requests = { [id: string]: RequestInfo; }; export default class AntServerBinding extends AntDevice implements IAntDevice { protected props: AntServerDeviceProps; protected server: ChildProcess; protected requests: Requests; protected serverData: string; protected pingIv: NodeJS.Timeout; protected lastPingTS: number; constructor(props: AntServerDeviceProps); protected getDevices(): any[]; protected launchServer(path: any): ChildProcess; startServer(): Promise<boolean>; stopServer(): void; onServerError(err: any): void; onServerStopped(): void; onServerData(data: any): void; onServerMessage(str: string): void; sendServerMessage(message: string): boolean; sendServerPing(): boolean; sendRequest(command: string, ...args: any[]): Promise<any>; open(): Promise<boolean>; close(): Promise<boolean>; write(data: Buffer): void; }