1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
Project: thormotion
GitHub: https://github.com/MillieFD/thormotion
BSD 3-Clause License, Copyright (c) 2025, Amelia Fraser-Dale
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the conditions of the LICENSE are met.
*/
/// Identifier for “generic USB units” (Thorlabs APT Protocol, Issue 39, Page 35).
///
/// Messages sent to Thorlabs devices use [`DEVICE`] as the destination byte.
/// Messages sent from Thorlabs devices use [`DEVICE`] as the source byte.
const DEVICE: u8 = 0x50;
/// Identifier for "host" (Thorlabs APT Protocol, Issue 39, Page 35).
///
/// Messages sent to Thorlabs devices use [`HOST`] as the source byte.
/// Messages sent from Thorlabs devices use [`HOST`] as the destination byte.
const HOST: u8 = 0x01;
/// Returns a six-byte header-only command, packaged according to the Thorlabs APT Protocol.
///
/// All Thorlabs commands use a fixed length six-byte message header. For simple commands, this
/// header is enough to convey the entire instruction. For more complex commands that require
/// additional data to be passed to the device, the six-byte header is followed by a
/// variable-length data packet.
pub
/// Returns a header-plus-payload command, packaged according to the Thorlabs APT Protocol.
///
/// All Thorlabs commands use a fixed length six-byte message header. For simple commands, this
/// header is enough to convey the entire instruction. For more complex commands that require
/// additional data to be passed to the device, the six-byte header is followed by a
/// variable-length data packet.
pub