gopro_controller/
command.rs1use crate::services::Sendable;
2pub enum GoProCommand {
10 ShutterStart,
11 ShutterStop,
12 Sleep,
13 AddHilightDuringEncoding,
14 VideoMode,
15 PhotoMode,
16 TimelapseMode,
17}
18
19impl AsRef<GoProCommand> for GoProCommand {
22 fn as_ref(&self) -> &GoProCommand {
23 self
24 }
25}
26
27use GoProCommand as GPC; impl Sendable for GPC {
37 fn as_bytes(&self) -> &'static [u8] {
38 match self.as_ref() {
39 GPC::ShutterStart => &[0x03, 0x01, 0x01, 0x01],
40 GPC::ShutterStop => &[0x03, 0x01, 0x01, 0x00],
41 GPC::Sleep => &[0x01, 0x05],
42 GPC::AddHilightDuringEncoding => &[0x01, 0x18],
43 GPC::VideoMode => &[0x04, 0x3E, 0x02, 0x03, 0xE8],
44 GPC::PhotoMode => &[0x04, 0x3E, 0x02, 0x03, 0xE9],
45 GPC::TimelapseMode => &[0x04, 0x3E, 0x02, 0x03, 0xEA],
46 }
47 }
48 fn response_value_bytes(&self) -> &'static [u8] {
49 match self.as_ref() {
50 GPC::ShutterStart => &[0x02, 0x01, 0x00],
51 GPC::ShutterStop => &[0x02, 0x01, 0x00],
52 GPC::Sleep => &[0x02, 0x05, 0x00],
53 GPC::AddHilightDuringEncoding => &[0x02, 0x18, 0x00],
54 GPC::VideoMode => &[0x02, 0x3E, 0x00],
55 GPC::PhotoMode => &[0x02, 0x3E, 0x00],
56 GPC::TimelapseMode => &[0x02, 0x3E, 0x00],
57 }
58 }
59}