ant-wireless 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abd16b62c0eb3b3e7e683fd46cca0382fa6b0400f23d8ae8a12de4455e66599a
4
- data.tar.gz: c0e7b0571d2cb8285f072b23027b226ac4c472e0b2147faa34c1bd13d4c78aef
3
+ metadata.gz: b16333eed832c3068cd6e95d167bffe8132aaba7543ccabd773d809fac840199
4
+ data.tar.gz: 92d089d1bcf5121dd46477befeabc33e43abbac10de105d3d94d176b54c9af8a
5
5
  SHA512:
6
- metadata.gz: 994058a2faa922f5d5469b9ab04aa5eecefaa6fdac4921a035a9bfe4f0ca58bea90a32f225c54d695f93b5cc27bcaf87ce2442b80160984944e7a04234eb0036
7
- data.tar.gz: 11f91861b51651d3cfba2309334ac4e9253a4ea9bc313bd0434f42eaa4a86e05d3659b11cfed13a85b162761b1913afb2da13d99faf58f1b14cf53b52fb03da3
6
+ metadata.gz: 51dbc06b6c199f16404fb0d79fd78e10cf53c4ca68e221462d225e1dff171a51f5f1807da2ebe2719e45109e981ece26781090ebd583d4c8c01d6e1539c5e43a
7
+ data.tar.gz: da1492d614d52e83402c85bbeed0d45d03f7f101bd6b5036ae9bc7a488dfbd5df41ee5aa2a0a3b0a7b4e7019c4d95bc55d0167a3a6e77c1825565ca299ba492e
checksums.yaml.gz.sig CHANGED
Binary file
data/History.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Release History for ruby-ant
2
2
 
3
3
  ---
4
+ ## v0.3.0 [2021-10-11] Michael Granger <ged@FaerieMUD.org>
5
+
6
+ Enhancements:
7
+
8
+ - Add frequency agility config to Channel
9
+ - Add tunable transmit power knob
10
+
11
+
4
12
  ## v0.2.1 [2021-09-30] Michael Granger <ged@FaerieMUD.org>
5
13
 
6
14
  Bugfixes:
@@ -309,6 +309,32 @@ rant_s_set_network_key( VALUE _module, VALUE network_number, VALUE key )
309
309
  }
310
310
 
311
311
 
312
+ /*
313
+ * call-seq:
314
+ * Ant.transmit_power = 4
315
+ *
316
+ * Set the transmit power level for all channels. Valid values are 0-4; default
317
+ * is 3 = 0dBm.
318
+ *
319
+ * # Set transmit power to -5 dBm
320
+ * Ant.transmit_power = 2
321
+ */
322
+ static VALUE
323
+ rant_s_transmit_power_eq( VALUE _module, VALUE power )
324
+ {
325
+ const unsigned char ucTransmitPower = NUM2CHR( power );
326
+ BOOL rval;
327
+
328
+ if ( ucTransmitPower < 0 || ucTransmitPower > 4 ) {
329
+ rb_raise( rb_eArgError, "expected a value between 0 and 4, got %d", ucTransmitPower );
330
+ }
331
+
332
+ rval = ANT_SetTransmitPower( ucTransmitPower );
333
+
334
+ return rval ? Qtrue : Qfalse;
335
+ }
336
+
337
+
312
338
  /*
313
339
  * call-seq:
314
340
  * Ant.assign_channel( channel, channel_type, network_number=0, extended_options=0x0, timeout=0 ) -> channel
@@ -575,6 +601,7 @@ Init_ant_ext()
575
601
  rb_define_singleton_method( rant_mAnt, "reset", rant_s_reset, 0 );
576
602
 
577
603
  rb_define_singleton_method( rant_mAnt, "set_network_key", rant_s_set_network_key, 2 );
604
+ rb_define_singleton_method( rant_mAnt, "transmit_power=", rant_s_transmit_power_eq, 1 );
578
605
  rb_define_singleton_method( rant_mAnt, "assign_channel", rant_s_assign_channel, -1 );
579
606
 
580
607
  rb_define_singleton_method( rant_mAnt, "use_extended_messages=",
@@ -132,6 +132,7 @@ rant_channel_init( VALUE self, VALUE channel_number, VALUE channel_type, VALUE n
132
132
  rb_iv_set( self, "@device_number", Qnil );
133
133
  rb_iv_set( self, "@transmission_type", Qnil );
134
134
  rb_iv_set( self, "@rf_frequency", Qnil );
135
+ rb_iv_set( self, "@agility_frequencies", Qnil );
135
136
 
136
137
  rb_hash_aset( registry, channel_number, self );
137
138
 
@@ -299,6 +300,31 @@ rant_channel_set_channel_rf_freq( VALUE self, VALUE frequency )
299
300
  }
300
301
 
301
302
 
303
+ static VALUE
304
+ rant_channet_set_frequency_agility( VALUE self, VALUE freq1, VALUE freq2, VALUE freq3 )
305
+ {
306
+ rant_channel_t *ptr = rant_get_channel( self );
307
+ unsigned char ucFreq1 = NUM2CHR( freq1 ),
308
+ ucFreq2 = NUM2CHR( freq2 ),
309
+ ucFreq3 = NUM2CHR( freq3 );
310
+ VALUE frequencies = rb_ary_new_from_args( 3, freq1, freq2, freq3 );
311
+
312
+ if ( ucFreq1 > 124 || ucFreq2 > 124 || ucFreq3 > 124 ) {
313
+ rb_raise( rb_eArgError, "frequencies must be between 0 and 124." );
314
+ }
315
+
316
+ rant_log_obj( self, "info",
317
+ "Configuring channel %d to use frequency agility on %d, %d, and %d MHz.",
318
+ ptr->channel_num, ucFreq1 + 2400, ucFreq2 + 2400, ucFreq3 + 2400 );
319
+ ANT_ConfigFrequencyAgility( ptr->channel_num, ucFreq1, ucFreq2, ucFreq3 );
320
+
321
+ rb_ary_freeze( frequencies );
322
+ rb_iv_set( self, "@agility_frequencies", frequencies );
323
+
324
+ return Qtrue;
325
+ }
326
+
327
+
302
328
 
303
329
 
304
330
  /*
@@ -588,12 +614,14 @@ init_ant_channel()
588
614
  rb_attr( rant_cAntChannel, rb_intern("device_type"), 1, 0, 0 );
589
615
  rb_attr( rant_cAntChannel, rb_intern("transmission_type"), 1, 0, 0 );
590
616
  rb_attr( rant_cAntChannel, rb_intern("rf_frequency"), 1, 0, 0 );
617
+ rb_attr( rant_cAntChannel, rb_intern("agility_frequencies"), 1, 0, 0 );
591
618
 
592
619
  rb_define_method( rant_cAntChannel, "set_channel_id", rant_channel_set_channel_id, -1 );
593
620
  rb_define_method( rant_cAntChannel, "set_channel_period", rant_channel_set_channel_period, -1 );
594
621
  rb_define_method( rant_cAntChannel, "set_channel_search_timeout",
595
622
  rant_channel_set_channel_search_timeout, -1 );
596
623
  rb_define_method( rant_cAntChannel, "set_channel_rf_freq", rant_channel_set_channel_rf_freq, 1 );
624
+ rb_define_method( rant_cAntChannel, "set_frequency_agility", rant_channet_set_frequency_agility, 3 );
597
625
 
598
626
  rb_define_method( rant_cAntChannel, "open", rant_channel_open, -1 );
599
627
  rb_define_method( rant_cAntChannel, "close", rant_channel_close, -1 );
@@ -48,6 +48,8 @@ module Ant::ResponseCallbacks
48
48
 
49
49
  Ant::Message::MESG_RADIO_TX_POWER_ID => :on_radio_tx_power,
50
50
 
51
+ Ant::Message::MESG_AUTO_FREQ_CONFIG_ID => :on_auto_freq_config,
52
+
51
53
  # :TODO: There are many other MESG_ constants, but I think most or all of
52
54
  # them are for the serial protocol.
53
55
  }
@@ -227,6 +229,13 @@ module Ant::ResponseCallbacks
227
229
  end
228
230
 
229
231
 
232
+ ### Handle on_rx_ext_mesgs_enable response event.
233
+ def on_auto_freq_config( channel_num, data )
234
+ self.log_response_event( channel_num, data, "enabling frequency agility",
235
+ "Enabled frequency agility." )
236
+ end
237
+
238
+
230
239
  ### Handle capabilities response event.
231
240
  def on_capabilities( channel_num, data )
232
241
  std_opts = Ant::BitVector.new( data.bytes[2] )
data/lib/ant.rb CHANGED
@@ -12,7 +12,7 @@ module Ant
12
12
  extend Loggability
13
13
 
14
14
  # Package version
15
- VERSION = '0.2.1'
15
+ VERSION = '0.3.0'
16
16
 
17
17
  # A Range for matching valid ANT device numbers
18
18
  VALID_DEVICE_NUMBERS = ( 0...65535 ).freeze
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ant-wireless
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -34,7 +34,7 @@ cert_chain:
34
34
  MCh97sQ/Z/MOusb5+QddBmB+k8EicXyGNl4b5L4XpL7fIQu+Y96TB3JEJlShxFD9
35
35
  k9FjI4d9EP54gS/4
36
36
  -----END CERTIFICATE-----
37
- date: 2021-09-30 00:00:00.000000000 Z
37
+ date: 2021-10-11 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: rake-compiler
metadata.gz.sig CHANGED
Binary file