ble-lwp3-service/protocol: add enums for hub types

This is the full list of hub types.
This commit is contained in:
David Lechner
2021-12-27 12:38:51 -06:00
parent 0759a0878f
commit 5f7a63fe5a
2 changed files with 55 additions and 1 deletions
+52
View File
@@ -0,0 +1,52 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 The Pybricks Authors
//
// Constants and helper functions for LEGO Wireless protocol v3.
//
// https://lego.github.io/lego-ble-wireless-protocol-docs/
/**
* LEGO Powered Up Hub type IDs
*
* https://github.com/pybricks/technical-info/blob/master/assigned-numbers.md#hub-type-ids
*/
export enum HubType {
/** WeDo 2.0 uses different protocol so shouldn't be seen in LWP3. */
WeDo2Hub = 0x00,
/** Duplo train hub. */
DuploTrainHub = 0x20,
/** BOOST Move hub. */
MoveHub = 0x40,
/** 2-port System hub. */
CityHub = 0x41,
/** Remote Control. */
Handset = 0x42,
/** Mario minifig. */
Mario = 0x43,
/** Luigi minifig. */
Luigi = 0x44,
/** 4-port Technic hub. */
TechnicHub = 0x80,
/** 6-port SPIKE/MINDSTORMS hub. */
TechnicLargeHub = 0x81,
/** 2-port SPIKE hub. */
TechnicSmallHub = 0x83,
}
/**
* Variants of the 6-port Technic Large hub.
*/
export enum TechnicLargeHubVariant {
/** Yellow SPIKE Prime variant. */
SpikePrimeHub = 0,
/** Teal MINDSTORMS Robot Inventor variant. */
MindstormsInventorHub = 1,
}
/**
* Variants of the 2-port Technic Small hub.
*/
export enum TechnicSmallHubVariant {
/** Yellow SPIKE Essential variant. */
SpikeEssentialHub = 0,
}
+3 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2020 The Pybricks Authors
// Copyright (c) 2020-2021 The Pybricks Authors
// Ref: https://lego.github.io/lego-ble-wireless-protocol-docs/index.html#lego-hub-boot-loader-service
@@ -22,6 +22,8 @@ export const MaxMessageSize = 20;
/**
* LEGO Powered Up Hub IDs
*
* This is the subset of hubs that actually support this bootloader protocol.
*/
export enum HubType {
MoveHub = 0x40,