import { Device } from "./device" ; import { IDeviceInterface } from "../interfaces" ; import * as Consts from "../consts" ; class extends Device export class DuploTrainBaseSpeedometer extends Device { constructor ( hub , portId ) { super ( hub , portId , ModeMap , Consts . DeviceType . DUPLO_TRAIN_BASE_SPEEDOMETER ) ; } public receive ( message ) { const mode = this . _mode ; switch ( mode ) { case Mode . SPEED : const speed = message . readInt16LE ( 4 ) ; event type { object } param { number } speed this . notify ( "speed" , { speed } ) ; break ; } } } export enum Mode { SPEED = 0x00 } export const ModeMap = { "speed" : Mode . SPEED } ;