Move DeviceType to first position in GetIdentification
This commit is contained in:
+5
-1
@@ -24,6 +24,10 @@ enum Chroma {
|
|||||||
Black,
|
Black,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetIdentification is always `0x00`, and the device should always return a response starting with
|
||||||
|
// the two-byte sequence `0x00 [DeviceType]`. Theoretically this leaves space for different devices
|
||||||
|
// to adopt different schemas (although we hope to only use this as a last resort).
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
enum Request<'a> {
|
enum Request<'a> {
|
||||||
GetIdentification,
|
GetIdentification,
|
||||||
@@ -38,7 +42,7 @@ enum Request<'a> {
|
|||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
enum Response<'a> {
|
enum Response<'a> {
|
||||||
GetIdentification { serial: &'a str, model: DeviceType },
|
GetIdentification { model: DeviceType, serial: &'a str },
|
||||||
UpdateDisplay,
|
UpdateDisplay,
|
||||||
SetPattern,
|
SetPattern,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ const requestSchema = p.enumType('Request', {
|
|||||||
export type Response = p.InferType<typeof responseSchema>
|
export type Response = p.InferType<typeof responseSchema>
|
||||||
const responseSchema = p.enumType('Response', {
|
const responseSchema = p.enumType('Response', {
|
||||||
GetIdentification: p.structVariant('GetIdentification', {
|
GetIdentification: p.structVariant('GetIdentification', {
|
||||||
serial: p.string(),
|
|
||||||
model: deviceTypeSchema,
|
model: deviceTypeSchema,
|
||||||
|
serial: p.string(),
|
||||||
}),
|
}),
|
||||||
UpdateDisplay: p.unitVariant('UpdateDisplay'),
|
UpdateDisplay: p.unitVariant('UpdateDisplay'),
|
||||||
SetPattern: p.unitVariant('SetPattern'),
|
SetPattern: p.unitVariant('SetPattern'),
|
||||||
|
|||||||
Reference in New Issue
Block a user