|
37 | 37 |
|
38 | 38 | namespace liboculus {
|
39 | 39 |
|
40 |
| -struct FlagBits { |
41 |
| - // bit 0: 0 = interpret range as percent, 1 = interpret range as meters |
42 |
| - // bit 1: 0 = 8 bit data, 1 = 16 bit data |
43 |
| - // bit 2: 0 = wont send gain, 1 = send gain |
44 |
| - // bit 3: 0 = send full return message, 1 = send simple return message |
45 |
| - // bit 4: "gain assistance"? |
46 |
| - // bit 6: use 512 beams (vs 256): email from Blueprint said to set flags |= 0x40 |
47 |
| - |
48 |
| - static const uint8_t RangeAsMeters = (0x01) << 0; |
49 |
| - static const uint8_t Data16Bits = (0x01) << 1; |
50 |
| - static const uint8_t DoSendGain = (0x01) << 2; |
51 |
| - static const uint8_t SimpleReturn = (0x01) << 3; |
52 |
| - static const uint8_t GainAssistance = (0x01) << 4; |
53 |
| - static const uint8_t Do512Beams = (0x01) << 6; |
54 |
| -}; |
55 |
| - |
56 |
| -// This class used to be both a way to store state and |
57 |
| -// deserializer. But it got awkward, so now it's |
58 |
| -// *only* a parser of flag bytes (does no allow setting) |
59 |
| -// configuration is stored outside of the bitfield in |
60 |
| -// SonarConfiguration, and the flag byte is made just-in-time |
61 |
| -class OculusSimpleFireFlags { |
62 |
| - public: |
63 |
| - OculusSimpleFireFlags() = delete; |
64 |
| - OculusSimpleFireFlags( const uint8_t flags ) |
65 |
| - : _data(flags) {;} |
66 |
| - |
67 |
| - bool getRangeAsMeters() const { return _data & FlagBits::RangeAsMeters; } |
68 |
| - bool getSendGain() const { return _data & FlagBits::DoSendGain; } |
69 |
| - bool getData16Bit() const { return _data & FlagBits::Data16Bits; } |
70 |
| - bool getSimpleReturn() const { return _data & FlagBits::SimpleReturn; } |
71 |
| - bool getGainAssistance() const { return _data & FlagBits::GainAssistance; } |
72 |
| - bool get512Beams() const { return _data & FlagBits::Do512Beams;} |
73 |
| - |
74 |
| - private: |
75 |
| - uint8_t _data; |
76 |
| -}; |
77 |
| - |
78 | 40 | // Thin OO wrapper around the OculusSimpleFireMessage.
|
79 | 41 | //
|
80 | 42 | // \todo This API is a little messy right now. Probably *shouldn't* keep
|
|
0 commit comments