lib/legacy/command_mode.rb in ruby-xbee-1.2.0 vs lib/legacy/command_mode.rb in ruby-xbee-1.2.1

- old
+ new

@@ -30,11 +30,11 @@ sleep 1 getresponse # flush up to +++ response if needed # if XBee is already in command mode, there will be no response, so make an explicit # AT call to insure an OK response @xbee_serialport.write("AT\r") - getresponse().strip.chomp if getresponse() + getresponse.strip.chomp end =begin rdoc Retrieve XBee firmware version =end @@ -121,11 +121,11 @@ =begin rdoc returns the source address of the XBee device - the MY address value =end def my_src_address @xbee_serialport.write("ATMY\r") - getresponse.strip.chomp if getresponse + getresponse.strip.chomp end =begin rdoc sets the 16-bit source address of the XBee device. The parameter should be a 16-bit hex value. The factory default is 0. By setting the MY src address to 0xffff, 16-bit addressing is disabled @@ -217,11 +217,11 @@ =end def node_id tmp = @xbee_serialport.read_timeout @xbee_serialport.read_timeout = read_timeout(:long) @xbee_serialport.write("ATNI\r") - response = getresponse + response = getresponse() @xbee_serialport.read_timeout = tmp if ( response.nil? ) return "" else response.strip.chomp @@ -272,11 +272,11 @@ or 0 to be returned. If the XBee device has not received any neighboring packet data, the signal strength value will be 0 =end def received_signal_strength @xbee_serialport.write("ATDB\r") - response = getresponse().strip.chomp if getresponse() + response = getresponse.strip.chomp # this response is an absolute hex value which is in -dBm # modify this so it returns actual - dBm value dbm = -(response.hex) if response end @@ -311,10 +311,10 @@ :Mark - for 8-bit mark :Space - for 8-bit space =end def parity @xbee_serialport.write("ATNB\r") - response = getresponse().strip.chomp if getresponse() + response = getresponse().strip.chomp @paritycodes.key( response.to_i ) end =begin rdoc sets the parity of the device to one represented by a symbol contained in the parity_type parameter