зеркало из https://github.com/microsoft/jacdac-ts.git
rename constants
This commit is contained in:
Родитель
0d73f9358a
Коммит
8cf64b5de0
|
@ -2,7 +2,7 @@ import { Packet } from "./packet";
|
|||
import { Device } from "./device";
|
||||
import { EventEmitter } from "./eventemitter";
|
||||
import { SMap, bufferEq } from "./utils";
|
||||
import { ConsolePriority, CMD_CONSOLE_SET_MIN_PRIORITY, JD_SERVICE_LOGGER, JD_SERVICE_NUMBER_CTRL, CMD_ADVERTISEMENT_DATA, CMD_EVENT } from "./constants";
|
||||
import { ConsolePriority, CMD_CONSOLE_SET_MIN_PRIORITY, SRV_LOGGER, JD_SERVICE_NUMBER_CTRL, CMD_ADVERTISEMENT_DATA, CMD_EVENT } from "./constants";
|
||||
|
||||
export interface BusOptions {
|
||||
sendPacketAsync: (p: Packet) => Promise<void>;
|
||||
|
@ -98,7 +98,7 @@ export class Bus extends EventEmitter implements PacketEventEmitter {
|
|||
private pingLoggers() {
|
||||
if (this._minConsolePriority < ConsolePriority.Silent) {
|
||||
const pkt = Packet.packed(CMD_CONSOLE_SET_MIN_PRIORITY, "i", [this._minConsolePriority]);
|
||||
pkt.sendAsMultiCommandAsync(this, JD_SERVICE_LOGGER);
|
||||
pkt.sendAsMultiCommandAsync(this, SRV_LOGGER);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,39 +85,39 @@ export enum ConsolePriority {
|
|||
}
|
||||
|
||||
/** known service numbers */
|
||||
export const JD_SERVICE_CTRL = 0;
|
||||
export const JD_SERVICE_LOGGER = 0x12dc1fca;
|
||||
export const JD_SERVICE_BATTERY = 0x1d2a2acd;
|
||||
export const JD_SERVICE_ACCELEROMETER = 0x1f140409;
|
||||
export const JD_SERVICE_BUTTON = 0x1473a263;
|
||||
export const JD_SERVICE_TOUCHBUTTON = 0x130cf5be;
|
||||
export const JD_SERVICE_LIGHT_SENSOR = 0x15e7a0ff;
|
||||
export const JD_SERVICE_MICROPHONE = 0x1a5c5866;
|
||||
export const JD_SERVICE_THERMOMETER = 0x1421bac7;
|
||||
export const JD_SERVICE_SWITCH = 0x14218172;
|
||||
export const JD_SERVICE_PIXEL = 0x1768fbbf;
|
||||
export const JD_SERVICE_HAPTIC = 0x116b14a3;
|
||||
export const JD_SERVICE_LIGHT = 0x126f00e0;
|
||||
export const JD_SERVICE_KEYBOARD = 0x1ae4812d;
|
||||
export const JD_SERVICE_MOUSE = 0x14bc97bf;
|
||||
export const JD_SERVICE_GAMEPAD = 0x100527e8;
|
||||
export const JD_SERVICE_MUSIC = 0x1b57b1d7;
|
||||
export const JD_SERVICE_SERVO = 0x12fc9103;
|
||||
export const JD_SERVICE_CONTROLLER = 0x188ae4b8;
|
||||
export const JD_SERVICE_LCD = 0x18d5284c;
|
||||
export const JD_SERVICE_MESSAGE_BUS = 0x115cabf5;
|
||||
export const JD_SERVICE_COLOR_SENSOR = 0x14d6dda2;
|
||||
export const JD_SERVICE_LIGHT_SPECTRUM_SENSOR = 0x16fa0c0d;
|
||||
export const JD_SERVICE_PROXIMITY = 0x14c1791b;
|
||||
export const JD_SERVICE_TOUCH_BUTTONS = 0x1acb49d5;
|
||||
export const JD_SERVICE_SERVOS = 0x182988d8;
|
||||
export const JD_SERVICE_ROTARY_ENCODER = 0x10fa29c9;
|
||||
export const JD_SERVICE_DNS = 0x117729bd;
|
||||
export const JD_SERVICE_PWM_LIGHT = 0x1fb57453;
|
||||
export const JD_SERVICE_BOOTLOADER = 0x1ffa9948;
|
||||
export const JD_SERVICE_ARCADE_CONTROLS = 0x1deaa06e;
|
||||
export const JD_SERVICE_POWER = 0x1fa4c95a;
|
||||
export const JD_SERVICE_SLIDER = 0x1f274746;
|
||||
export const JD_SERVICE_MOTOR = 0x17004cd8;
|
||||
export const JD_SERVICE_TCP = 0x1b43b70b;
|
||||
export const JD_SERVICE_WIFI = 0x18aae1fa;
|
||||
export const SRV_CTRL = 0;
|
||||
export const SRV_LOGGER = 0x12dc1fca;
|
||||
export const SRV_BATTERY = 0x1d2a2acd;
|
||||
export const SRV_ACCELEROMETER = 0x1f140409;
|
||||
export const SRV_BUTTON = 0x1473a263;
|
||||
export const SRV_TOUCHBUTTON = 0x130cf5be;
|
||||
export const SRV_LIGHT_SENSOR = 0x15e7a0ff;
|
||||
export const SRV_MICROPHONE = 0x1a5c5866;
|
||||
export const SRV_THERMOMETER = 0x1421bac7;
|
||||
export const SRV_SWITCH = 0x14218172;
|
||||
export const SRV_PIXEL = 0x1768fbbf;
|
||||
export const SRV_HAPTIC = 0x116b14a3;
|
||||
export const SRV_LIGHT = 0x126f00e0;
|
||||
export const SRV_KEYBOARD = 0x1ae4812d;
|
||||
export const SRV_MOUSE = 0x14bc97bf;
|
||||
export const SRV_GAMEPAD = 0x100527e8;
|
||||
export const SRV_MUSIC = 0x1b57b1d7;
|
||||
export const SRV_SERVO = 0x12fc9103;
|
||||
export const SRV_CONTROLLER = 0x188ae4b8;
|
||||
export const SRV_LCD = 0x18d5284c;
|
||||
export const SRV_MESSAGE_BUS = 0x115cabf5;
|
||||
export const SRV_COLOR_SENSOR = 0x14d6dda2;
|
||||
export const SRV_LIGHT_SPECTRUM_SENSOR = 0x16fa0c0d;
|
||||
export const SRV_PROXIMITY = 0x14c1791b;
|
||||
export const SRV_TOUCH_BUTTONS = 0x1acb49d5;
|
||||
export const SRV_SERVOS = 0x182988d8;
|
||||
export const SRV_ROTARY_ENCODER = 0x10fa29c9;
|
||||
export const SRV_DNS = 0x117729bd;
|
||||
export const SRV_PWM_LIGHT = 0x1fb57453;
|
||||
export const SRV_BOOTLOADER = 0x1ffa9948;
|
||||
export const SRV_ARCADE_CONTROLS = 0x1deaa06e;
|
||||
export const SRV_POWER = 0x1fa4c95a;
|
||||
export const SRV_SLIDER = 0x1f274746;
|
||||
export const SRV_MOTOR = 0x17004cd8;
|
||||
export const SRV_TCP = 0x1b43b70b;
|
||||
export const SRV_WIFI = 0x18aae1fa;
|
||||
|
|
|
@ -7,41 +7,41 @@ import { intOfBuffer } from "./buffer"
|
|||
const service_classes: U.SMap<number> = {
|
||||
"<disabled>": -1,
|
||||
CTRL: 0,
|
||||
LOGGER: jd.JD_SERVICE_LOGGER,
|
||||
BATTERY: jd.JD_SERVICE_BATTERY,
|
||||
ACCELEROMETER: jd.JD_SERVICE_ACCELEROMETER,
|
||||
BUTTON: jd.JD_SERVICE_BUTTON,
|
||||
TOUCHBUTTON: jd.JD_SERVICE_TOUCHBUTTON,
|
||||
LIGHT_SENSOR: jd.JD_SERVICE_LIGHT_SENSOR,
|
||||
MICROPHONE: jd.JD_SERVICE_MICROPHONE,
|
||||
THERMOMETER: jd.JD_SERVICE_THERMOMETER,
|
||||
SWITCH: jd.JD_SERVICE_SWITCH,
|
||||
PIXEL: jd.JD_SERVICE_PIXEL,
|
||||
HAPTIC: jd.JD_SERVICE_HAPTIC,
|
||||
LIGHT: jd.JD_SERVICE_LIGHT,
|
||||
KEYBOARD: jd.JD_SERVICE_KEYBOARD,
|
||||
MOUSE: jd.JD_SERVICE_MOUSE,
|
||||
GAMEPAD: jd.JD_SERVICE_GAMEPAD,
|
||||
MUSIC: jd.JD_SERVICE_MUSIC,
|
||||
SERVO: jd.JD_SERVICE_SERVO,
|
||||
CONTROLLER: jd.JD_SERVICE_CONTROLLER,
|
||||
LCD: jd.JD_SERVICE_LCD,
|
||||
MESSAGE_BUS: jd.JD_SERVICE_MESSAGE_BUS,
|
||||
COLOR_SENSOR: jd.JD_SERVICE_COLOR_SENSOR,
|
||||
LIGHT_SPECTRUM_SENSOR: jd.JD_SERVICE_LIGHT_SPECTRUM_SENSOR,
|
||||
PROXIMITY: jd.JD_SERVICE_PROXIMITY,
|
||||
TOUCH_BUTTONS: jd.JD_SERVICE_TOUCH_BUTTONS,
|
||||
SERVOS: jd.JD_SERVICE_SERVOS,
|
||||
ROTARY_ENCODER: jd.JD_SERVICE_ROTARY_ENCODER,
|
||||
DNS: jd.JD_SERVICE_DNS,
|
||||
PWM_LIGHT: jd.JD_SERVICE_PWM_LIGHT,
|
||||
BOOTLOADER: jd.JD_SERVICE_BOOTLOADER,
|
||||
ARCADE_CONTROLS: jd.JD_SERVICE_ARCADE_CONTROLS,
|
||||
POWER: jd.JD_SERVICE_POWER,
|
||||
SLIDER: jd.JD_SERVICE_SLIDER,
|
||||
MOTOR: jd.JD_SERVICE_MOTOR,
|
||||
TCP: jd.JD_SERVICE_TCP,
|
||||
WIFI: jd.JD_SERVICE_WIFI,
|
||||
LOGGER: jd.SRV_LOGGER,
|
||||
BATTERY: jd.SRV_BATTERY,
|
||||
ACCELEROMETER: jd.SRV_ACCELEROMETER,
|
||||
BUTTON: jd.SRV_BUTTON,
|
||||
TOUCHBUTTON: jd.SRV_TOUCHBUTTON,
|
||||
LIGHT_SENSOR: jd.SRV_LIGHT_SENSOR,
|
||||
MICROPHONE: jd.SRV_MICROPHONE,
|
||||
THERMOMETER: jd.SRV_THERMOMETER,
|
||||
SWITCH: jd.SRV_SWITCH,
|
||||
PIXEL: jd.SRV_PIXEL,
|
||||
HAPTIC: jd.SRV_HAPTIC,
|
||||
LIGHT: jd.SRV_LIGHT,
|
||||
KEYBOARD: jd.SRV_KEYBOARD,
|
||||
MOUSE: jd.SRV_MOUSE,
|
||||
GAMEPAD: jd.SRV_GAMEPAD,
|
||||
MUSIC: jd.SRV_MUSIC,
|
||||
SERVO: jd.SRV_SERVO,
|
||||
CONTROLLER: jd.SRV_CONTROLLER,
|
||||
LCD: jd.SRV_LCD,
|
||||
MESSAGE_BUS: jd.SRV_MESSAGE_BUS,
|
||||
COLOR_SENSOR: jd.SRV_COLOR_SENSOR,
|
||||
LIGHT_SPECTRUM_SENSOR: jd.SRV_LIGHT_SPECTRUM_SENSOR,
|
||||
PROXIMITY: jd.SRV_PROXIMITY,
|
||||
TOUCH_BUTTONS: jd.SRV_TOUCH_BUTTONS,
|
||||
SERVOS: jd.SRV_SERVOS,
|
||||
ROTARY_ENCODER: jd.SRV_ROTARY_ENCODER,
|
||||
DNS: jd.SRV_DNS,
|
||||
PWM_LIGHT: jd.SRV_PWM_LIGHT,
|
||||
BOOTLOADER: jd.SRV_BOOTLOADER,
|
||||
ARCADE_CONTROLS: jd.SRV_ARCADE_CONTROLS,
|
||||
POWER: jd.SRV_POWER,
|
||||
SLIDER: jd.SRV_SLIDER,
|
||||
MOTOR: jd.SRV_MOTOR,
|
||||
TCP: jd.SRV_TCP,
|
||||
WIFI: jd.SRV_WIFI,
|
||||
}
|
||||
|
||||
const generic_commands: U.SMap<number> = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче