Goby v2
mm_driver.proto
1 
2 import "goby/acomms/protobuf/driver_base.proto";
3 import "goby/acomms/protobuf/modem_message.proto";
4 import "goby/common/protobuf/option_extensions.proto";
5 import "dccl/option_extensions.proto";
6 
7 package micromodem.protobuf;
8 
9 message NarrowBandLBLParams
10 {
11  // for MICROMODEM_NARROWBAND_LBL_RANGING
12  optional uint32 transmit_freq = 1; // in hertz
13  optional uint32 transmit_ping_ms = 2; // length of tx ping
14  repeated uint32 receive_freq =
15  3; // in hertz, first element (0) == beacon A, etc.
16  optional uint32 receive_ping_ms = 4; // length of rx ping
17 
18  optional uint32 turnaround_ms = 5;
19  optional bool transmit_flag = 6
20  [default =
21  true]; // Flag to indicate whether the transmit signal is
22  // actually sent (1), or whether the ping is initiated
23  // with an external synchronization pulse (0).
24 
25  // meters
26  optional uint32 lbl_max_range = 7 [default = 2000];
27 }
28 
29 message REMUSLBLParams
30 {
31  // for MICROMODEM_REMUS_LBL_RANGING
32  // LSB->MSB is LBL beacons 1,2,3,... true is enabled, false is disabled
33  // enable four beacons is b1111 == d15
34  optional uint32 enable_beacons = 1 [default = 15];
35  optional uint32 turnaround_ms = 2 [default = 50];
36 
37  // meters
38  optional uint32 lbl_max_range = 3 [default = 1000];
39 }
40 
41 message GenericLBLParams
42 {
43  // for MICROMODEM_GENERIC_LBL_RANGING
44  optional uint32 transmit_freq = 1; // in hertz
45  optional uint32 n_bits =
46  2; // number of bits to use from the signal sequence, same for outgoing
47  // as well as incoming pings
48  optional uint64 transmit_seq_code =
49  3; // outgoing sequence bits, packed into a 64 bit int
50  optional uint32 receive_freq =
51  4; // in hertz, first element (0) == beacon A, etc.
52  repeated uint64 receive_seq_code = 5; // signals to receive
53  optional uint32 bandwidth =
54  6; // chiprate/bandwidth, of outgoing and receive signals
55 
56  optional uint32 turnaround_ms = 7;
57  // meters
58  optional uint32 lbl_max_range = 8 [default = 2000];
59 }
60 
61 message FMSweepParams
62 {
63  // for MICROMODEM_FM_SWEEP
64  required double start_freq = 1;
65  required double stop_freq = 2;
66  required double duration_ms = 3;
67  optional uint32 number_repetitions = 4 [default = 1];
68  optional double repetition_period_ms = 5 [default = 1000];
69 }
70 
71 message MSequenceParams
72 {
73  // for MICROMODEM_M_SEQUENCE
74  required uint32 seqlen_bits =
75  1; // Sequence length, bits. Should be 2k-1, where k={4...16}
76  required uint32 number_repetitions =
77  2; // number of repetitions, between 3 to 60.
78  required uint32 carrier_cycles_per_chip = 3;
79  required uint32 carrier_freq = 4; // carrier, Hz
80 }
81 
82 message Config
83 {
84  extend goby.acomms.protobuf.DriverConfig
85  {
86  // reset all NVRAM settings to factory before
87  // setting ours ($CCCFG,ALL,0)
88  optional bool reset_nvram = 1000 [default = false];
89 
90  // add NVRAM configuration sentences to send to the modem
91  // on startup (e.g. "$CACFG,SRC,1"). Omit the "$CACFG," here.
92  // To reinitialize all values to factory settings, send "ALL,0"
93  repeated string nvram_cfg = 1001; // e.g. "SRC,3"
94 
95  // set to a non-zero value to indicate that we are using the hydroid
96  // gateway buoy which has a non-standard sentence structure (#M / !M
97  // prefixes) *do not set for the normal WHOI Micro-Modem*
98  optional uint32 hydroid_gateway_id = 1002 [default = 0];
99 
100  // LBL parameters can be set globally here or on a per-transmission
101  // basis
102  optional NarrowBandLBLParams narrowband_lbl = 1003;
103  optional REMUSLBLParams remus_lbl = 1004;
104 
105  optional int32 keep_alive_seconds = 1006 [default = 10];
106 
107  optional int32 allowed_skew_ms = 1008 [default = 1000];
108 
109  optional bool use_application_acks = 1009 [default = false];
110 
111  optional GenericLBLParams generic_lbl = 1010;
112 
113  optional FMSweepParams fm_sweep = 1011;
114  optional MSequenceParams m_sequence = 1012;
115  }
116 }
117 
118 enum ClockMode
119 {
120  INVALID_CLOCK_MODE = -1;
121  NO_SYNC_TO_PPS_AND_CCCLK_BAD = 0;
122  NO_SYNC_TO_PPS_AND_CCCLK_GOOD = 1;
123  SYNC_TO_PPS_AND_CCCLK_BAD = 2;
124  SYNC_TO_PPS_AND_CCCLK_GOOD = 3;
125 }
126 
127 message RangingReply
128 {
129  option (dccl.msg).id = 128;
130  option (dccl.msg).max_bytes = 32;
131 
132  // seconds
133  repeated double one_way_travel_time = 1 [
134  (dccl.field).min = 0,
135  (dccl.field).max = 30,
136  (dccl.field).precision = 3,
137  (dccl.field).max_repeat = 4
138  ];
139  enum OWTTAmbiguity
140  {
141  OWTT_EXACT = 1; // one_way_travel_time reported is correct and known
142  OWTT_SECOND_AMBIGUOUS = 2; // one way travel time fractional second is
143  // correct, but second is unknown
144  }
145  optional OWTTAmbiguity ambiguity = 2 [default = OWTT_EXACT];
146  optional bool is_one_way_synchronous = 3
147  [default = false]; // if false, type given by ModemTransmission.type
148  optional ClockMode receiver_clk_mode = 4
149  [default = NO_SYNC_TO_PPS_AND_CCCLK_BAD];
150  optional ClockMode sender_clk_mode = 5
151  [default = NO_SYNC_TO_PPS_AND_CCCLK_BAD];
152 }
153 
154 enum PacketType
155 {
156  PACKET_TYPE_UNKNOWN = -1;
157  FSK = 1;
158  FSK_MINI = 2;
159  PSK = 3;
160  PSK_MINI = 4;
161  FLEXIBLE_DATA_PACKET = 5;
162 }
163 
164 enum ReceiveMode
165 {
166  INVALID_RECEIVE_MODE = -1;
167  RECEIVE_GOOD = 0;
168  BAD_CRC = 1;
169  PACKET_TIMEOUT = 2;
170 }
171 
172 enum PSKErrorCode
173 {
174  INVALID_PSK_ERROR_CODE = -1;
175  NO_ERROR = 0;
176  BAD_MODULATION_HEADER = 1;
177  BAD_CRC_DATA_HEADER = 2;
178  BAD_CRC_AT_LEAST_ONE_FRAME = 3;
179  ERROR_ACCESSING_COPROC = 4;
180  EQUALIZER_TIMEOUT = 5;
181  MISSED_START_OF_PSK_PACKET = 6;
182 }
183 
184 // $CACST,0,223413.0000,0,1440,25,0175,0166,75,01,01,01,03,1,007,006,0,3,3,0,146,03,04,-100,-1,000,-1.2,45,10000,2000
185 message ReceiveStatistics
186 {
187  option (dccl.msg).id = 129;
188  option (dccl.msg).max_bytes = 32;
189 
190  // including in "version 0", or the original CACST
191  required ReceiveMode mode = 1;
192  required uint64 time = 2 [(dccl.field).codec = "_time"];
193  required ClockMode clock_mode = 3;
194  optional int32 mfd_peak = 4 [(dccl.field).omit = true];
195  required int32 mfd_power = 5
196  [(dccl.field).min = -30, (dccl.field).max = 40];
197  required int32 mfd_ratio = 6
198  [(dccl.field).min = 0, (dccl.field).max = 16383];
199  optional int32 spl = 7 [(dccl.field).omit = true];
200  optional int32 shf_agn = 8 [(dccl.field).omit = true];
201  optional int32 shf_ainpshift = 9 [(dccl.field).omit = true];
202  optional int32 shf_ainshift = 10 [(dccl.field).omit = true];
203  optional int32 shf_mfdshift = 11 [(dccl.field).omit = true];
204  optional int32 shf_p2bshift = 12 [(dccl.field).omit = true];
205  required int32 rate = 13 [(dccl.field).min = -1, (dccl.field).max = 6];
206  required int32 source = 14 [(dccl.field).min = 0, (dccl.field).max = 127];
207  required int32 dest = 15 [(dccl.field).min = 0, (dccl.field).max = 127];
208  required PSKErrorCode psk_error_code = 16;
209  required PacketType packet_type = 17;
210  required int32 number_frames = 18
211  [(dccl.field).min = 0, (dccl.field).max = 8];
212  required int32 number_bad_frames = 19
213  [(dccl.field).min = 0, (dccl.field).max = 8];
214  required int32 snr_rss = 20 [(dccl.field).min = 0, (dccl.field).max = 255];
215  required int32 snr_in = 21 [(dccl.field).min = -10, (dccl.field).max = 30];
216  required int32 snr_out = 22 [(dccl.field).min = 0, (dccl.field).max = 25];
217  required int32 snr_symbols = 23
218  [(dccl.field).min = 0, (dccl.field).max = 30];
219  required int32 mse_equalizer = 24
220  [(dccl.field).min = -30, (dccl.field).max = 5];
221  required int32 data_quality_factor = 25
222  [(dccl.field).min = 0, (dccl.field).max = 255];
223  required double doppler = 26 [
224  (dccl.field).min = -3,
225  (dccl.field).max = 3,
226  (dccl.field).precision = 1
227  ];
228  required int32 stddev_noise = 27
229  [(dccl.field).min = 0, (dccl.field).max = 255];
230  required int32 carrier_freq = 28
231  [(dccl.field).min = 100, (dccl.field).max = 30000];
232  required int32 bandwidth = 29
233  [(dccl.field).min = 1000, (dccl.field).max = 5000];
234 
235  // new for "version 6+", firmware 0.93.0.52+
236  optional int32 version = 30 [default = 0, (dccl.field).omit = true];
237  optional string date = 31 [(dccl.field).omit = true];
238  optional int32 pcm = 32 [(dccl.field).omit = true];
239 }
240 
241 enum TransmitMode
242 {
243  INVALID_TRANSMIT_MODE = -1;
244  TRANSMIT_SUCCESSFUL = 0;
245  FETS_TOO_HOT = 1;
246  EXTSYNC_TIMEOUT = 2;
247  TX_INHIBITED = 3;
248  DATA_TIMEOUT = 4;
249 }
250 
251 message TransmitStatistics
252 {
253  optional string date = 1;
254  optional string time = 2;
255  optional ClockMode clock_mode = 3;
256  optional TransmitMode mode = 4;
257  optional int32 probe_length = 5;
258  optional int32 bandwidth = 6;
259  optional int32 carrier_freq = 7;
260  optional int32 rate = 8;
261  optional int32 source = 9;
262  optional int32 dest = 10;
263  optional bool ack_requested = 11;
264  optional int32 number_frames_expected = 12;
265  optional int32 number_frames_sent = 13;
266  optional PacketType packet_type = 14;
267  optional int32 number_bytes = 15;
268 
269  optional int32 version = 100 [default = 0];
270 }
271 
272 enum TransmissionType
273 {
274  BASE_TYPE = 0;
275 
276  MICROMODEM_TWO_WAY_PING =
277  1; // modem 1 interrogates modem 2; modem 2 replies and modem 1
278  // computes one way travel time: $CCMPC
279  MICROMODEM_REMUS_LBL_RANGING = 2; // modem 1 pings a REMUS network of long
280  // baseline (LBL) beacons: $CCPDT
281  MICROMODEM_NARROWBAND_LBL_RANGING =
282  3; // modem 1 pings up to four transponders: $CCPNT
283  MICROMODEM_MINI_DATA =
284  4; // 13 bits (represented as a 1 frame, 2 byte data transmission where
285  // data is AND'd with 0x1ff) mini data transmission
286  MICROMODEM_FLEXIBLE_DATA =
287  5; // Flexible Data Protocol in Micro-Modem 2: Up to 100 bytes
288  MICROMODEM_HARDWARE_CONTROL = 6; // $CCMEC for writing hardware lines
289  MICROMODEM_HARDWARE_CONTROL_REPLY =
290  7; // $CAMER response to writing hardware lines
291  MICROMODEM_GENERIC_LBL_RANGING =
292  8; // $CCPGT Ping Generic Transponder from host to modem
293  MICROMODEM_FM_SWEEP = 9; // $CCSWP Send an FM sweep
294  MICROMODEM_M_SEQUENCE = 10; // $CCMSQ Send a maximal-length sequence
295 }
296 
297 enum HardwareLine
298 {
299  option allow_alias = true;
300 
301  MM2_GPIO1 = 5;
302  MM2_GPIO2 = 6;
303  MM2_GPIO3 = 3;
304  MM2_GPIO4 = 2;
305  MM2_GPIO5 = 4;
306 
307  MM1_EXTSEL1 = 1;
308  MM1_EXTSEL2 = 2;
309  MM1_GPIO = 3;
310  MM1_COM1 = 7;
311  MM1_COM2 = 8;
312 }
313 
314 enum HardwareControlMode
315 {
316  READ_LINE = 0;
317  SET_VALUE = 1;
318  TOGGLE_HIGH = 2;
319  TOGGLE_LOW = 3;
320 }
321 
322 enum HardwareControlArgument
323 {
324  option allow_alias = true;
325 
326  MODE1_OFF = 0;
327  MODE1_ON = 1;
328 
329  TOGGLE_1MS = 0;
330  TOGGLE_HALF_SEC = 1;
331  TOGGLE_1_SEC = 2;
332  TOGGLE_2_SEC = 3;
333  TOGGLE_6_SEC = 4;
334  TOGGLE_10_SEC = 5;
335  TOGGLE_20_SEC = 6;
336  TOGGLE_30_SEC = 7;
337 
338  MODE0_ARG = 0;
339 }
340 
341 message HardwareControl
342 {
343  required HardwareLine line = 1;
344  required HardwareControlMode mode = 2;
345  optional HardwareControlArgument arg = 3 [default = MODE0_ARG];
346 }
347 
348 message HardwareControlCommand
349 {
350  option (dccl.msg).id = 515;
351  option (dccl.msg).max_bytes = 32;
352  option (dccl.msg).codec_version = 3;
353 
354  required int32 command_src = 1 [
355  (dccl.field).min = 0,
356  (dccl.field).max = 31,
357  (dccl.field).in_head = true
358  ];
359  required int32 command_dest = 2 [
360  (dccl.field).min = 0,
361  (dccl.field).max = 31,
362  (dccl.field).in_head = true
363  ];
364  optional uint64 time = 3
365  [(dccl.field).in_head = true, (dccl.field).codec = "_time"];
366 
367  // destination of $CCMEC command (defaults to same as command_dest)
368  optional int32 hw_ctl_dest = 4
369  [(dccl.field).min = 0, (dccl.field).max = 31];
370 
371  optional HardwareControl control = 5;
372 }
373 
374 extend goby.acomms.protobuf.ModemTransmission
375 {
376  optional TransmissionType type = 1000 [
377  (goby.field).description =
378  "Type of transmission if base `type` == DRIVER_SPECIFIC",
379  default = BASE_TYPE
380  ];
381 
382  // LBL parameters will be merged with configuration parameters. If a
383  // parameter is set in both places, the ones set here take precedence.
384  optional NarrowBandLBLParams narrowband_lbl = 1001
385  [(dccl.field).omit = true];
386  optional REMUSLBLParams remus_lbl = 1002 [(dccl.field).omit = true];
387 
388  optional RangingReply ranging_reply = 1003
389  [(dccl.field).omit = true, (goby.field).cfg.action = NEVER];
390  repeated ReceiveStatistics receive_stat = 1004
391  [(dccl.field).omit = true,
392  (goby.field).cfg.action = NEVER]; // $CACST
393  repeated TransmitStatistics transmit_stat = 1005
394  [(dccl.field).omit = true,
395  (goby.field).cfg.action = NEVER]; // $CAXST
396  repeated int32 frame_with_bad_crc = 1006
397  [(dccl.field).omit = true, (goby.field).cfg.action = NEVER];
398 
399  optional HardwareControl hw_ctl = 1007 [(dccl.field).omit = true];
400 
401  optional GenericLBLParams generic_lbl = 1008 [(dccl.field).omit = true];
402  optional FMSweepParams fm_sweep = 1009 [(dccl.field).omit = true];
403  optional MSequenceParams m_sequence = 1010 [(dccl.field).omit = true];
404 }
405 
406 message MMApplicationAck
407 {
408  option (dccl.msg).id = 10;
409  option (dccl.msg).max_bytes = 32;
410  option (dccl.msg).codec_version = 3;
411 
412  repeated AckPart part = 1 [(dccl.field).max_repeat = 4];
413  message AckPart
414  {
415  required int32 ack_dest = 1
416  [(dccl.field).min = 0, (dccl.field).max = 31];
417 
418  required uint32 acked_frames = 2
419  [(dccl.field).min = 0, (dccl.field).max = 0xFFFFFFFF];
420  }
421 
422  required bool ack_requested = 3;
423  required uint32 frame_start = 4
424  [(dccl.field).min = 0, (dccl.field).max = 31];
425 }