Class: Tinkerforge::BrickletGPSV3

Inherits:
Device
  • Object
show all
Defined in:
lib/tinkerforge/bricklet_gps_v3.rb

Overview

Determine position, velocity and altitude using GPS

Constant Summary collapse

DEVICE_IDENTIFIER =

:nodoc:

2171
DEVICE_DISPLAY_NAME =

:nodoc:

'GPS Bricklet 3.0'
CALLBACK_PULSE_PER_SECOND =

This callback is triggered precisely once per second, see ‘PPS <en.wikipedia.org/wiki/Pulse-per-second_signal>`__.

The precision of two subsequent pulses will be skewed because of the latency in the USB/RS485/Ethernet connection. But in the long run this will be very precise. For example a count of 3600 pulses will take exactly 1 hour.

21
CALLBACK_COORDINATES =

This callback is triggered periodically with the period that is set by BrickletGPSV3#set_coordinates_callback_period. The parameters are the same as for BrickletGPSV3#get_coordinates.

The CALLBACK_COORDINATES callback is only triggered if the coordinates changed since the last triggering and if there is currently a fix as indicated by BrickletGPSV3#get_status.

22
CALLBACK_STATUS =

This callback is triggered periodically with the period that is set by BrickletGPSV3#set_status_callback_period. The parameters are the same as for BrickletGPSV3#get_status.

The CALLBACK_STATUS callback is only triggered if the status changed since the last triggering.

23
CALLBACK_ALTITUDE =

This callback is triggered periodically with the period that is set by BrickletGPSV3#set_altitude_callback_period. The parameters are the same as for BrickletGPSV3#get_altitude.

The CALLBACK_ALTITUDE callback is only triggered if the altitude changed since the last triggering and if there is currently a fix as indicated by BrickletGPSV3#get_status.

24
CALLBACK_MOTION =

This callback is triggered periodically with the period that is set by BrickletGPSV3#set_motion_callback_period. The parameters are the same as for BrickletGPSV3#get_motion.

The CALLBACK_MOTION callback is only triggered if the motion changed since the last triggering and if there is currently a fix as indicated by BrickletGPSV3#get_status.

25
CALLBACK_DATE_TIME =

This callback is triggered periodically with the period that is set by BrickletGPSV3#set_date_time_callback_period. The parameters are the same as for BrickletGPSV3#get_date_time.

The CALLBACK_DATE_TIME callback is only triggered if the date or time changed since the last triggering.

26
FUNCTION_GET_COORDINATES =

:nodoc:

1
FUNCTION_GET_STATUS =

:nodoc:

2
FUNCTION_GET_ALTITUDE =

:nodoc:

3
FUNCTION_GET_MOTION =

:nodoc:

4
FUNCTION_GET_DATE_TIME =

:nodoc:

5
FUNCTION_RESTART =

:nodoc:

6
FUNCTION_GET_SATELLITE_SYSTEM_STATUS_LOW_LEVEL =

:nodoc:

7
FUNCTION_GET_SATELLITE_STATUS =

:nodoc:

8
FUNCTION_SET_FIX_LED_CONFIG =

:nodoc:

9
FUNCTION_GET_FIX_LED_CONFIG =

:nodoc:

10
FUNCTION_SET_COORDINATES_CALLBACK_PERIOD =

:nodoc:

11
FUNCTION_GET_COORDINATES_CALLBACK_PERIOD =

:nodoc:

12
FUNCTION_SET_STATUS_CALLBACK_PERIOD =

:nodoc:

13
FUNCTION_GET_STATUS_CALLBACK_PERIOD =

:nodoc:

14
FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD =

:nodoc:

15
FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD =

:nodoc:

16
FUNCTION_SET_MOTION_CALLBACK_PERIOD =

:nodoc:

17
FUNCTION_GET_MOTION_CALLBACK_PERIOD =

:nodoc:

18
FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD =

:nodoc:

19
FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD =

:nodoc:

20
FUNCTION_SET_SBAS_CONFIG =

:nodoc:

27
FUNCTION_GET_SBAS_CONFIG =

:nodoc:

28
FUNCTION_GET_SPITFP_ERROR_COUNT =

:nodoc:

234
FUNCTION_SET_BOOTLOADER_MODE =

:nodoc:

235
FUNCTION_GET_BOOTLOADER_MODE =

:nodoc:

236
FUNCTION_SET_WRITE_FIRMWARE_POINTER =

:nodoc:

237
FUNCTION_WRITE_FIRMWARE =

:nodoc:

238
FUNCTION_SET_STATUS_LED_CONFIG =

:nodoc:

239
FUNCTION_GET_STATUS_LED_CONFIG =

:nodoc:

240
FUNCTION_GET_CHIP_TEMPERATURE =

:nodoc:

242
FUNCTION_RESET =

:nodoc:

243
FUNCTION_WRITE_UID =

:nodoc:

248
FUNCTION_READ_UID =

:nodoc:

249
FUNCTION_GET_IDENTITY =

:nodoc:

255
RESTART_TYPE_HOT_START =

:nodoc:

0
RESTART_TYPE_WARM_START =

:nodoc:

1
RESTART_TYPE_COLD_START =

:nodoc:

2
RESTART_TYPE_FACTORY_RESET =

:nodoc:

3
SATELLITE_SYSTEM_GPS =

:nodoc:

0
SATELLITE_SYSTEM_GLONASS =

:nodoc:

1
SATELLITE_SYSTEM_GALILEO =

:nodoc:

2
FIX_NO_FIX =

:nodoc:

1
FIX_2D_FIX =

:nodoc:

2
FIX_3D_FIX =

:nodoc:

3
FIX_LED_CONFIG_OFF =

:nodoc:

0
FIX_LED_CONFIG_ON =

:nodoc:

1
FIX_LED_CONFIG_SHOW_HEARTBEAT =

:nodoc:

2
FIX_LED_CONFIG_SHOW_FIX =

:nodoc:

3
FIX_LED_CONFIG_SHOW_PPS =

:nodoc:

4
SBAS_ENABLED =

:nodoc:

0
SBAS_DISABLED =

:nodoc:

1
BOOTLOADER_MODE_BOOTLOADER =

:nodoc:

0
BOOTLOADER_MODE_FIRMWARE =

:nodoc:

1
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT =

:nodoc:

2
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT =

:nodoc:

3
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT =

:nodoc:

4
BOOTLOADER_STATUS_OK =

:nodoc:

0
BOOTLOADER_STATUS_INVALID_MODE =

:nodoc:

1
BOOTLOADER_STATUS_NO_CHANGE =

:nodoc:

2
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT =

:nodoc:

3
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT =

:nodoc:

4
BOOTLOADER_STATUS_CRC_MISMATCH =

:nodoc:

5
STATUS_LED_CONFIG_OFF =

:nodoc:

0
STATUS_LED_CONFIG_ON =

:nodoc:

1
STATUS_LED_CONFIG_SHOW_HEARTBEAT =

:nodoc:

2
STATUS_LED_CONFIG_SHOW_STATUS =

:nodoc:

3

Constants inherited from Device

Device::DEVICE_IDENTIFIER_CHECK_MATCH, Device::DEVICE_IDENTIFIER_CHECK_MISMATCH, Device::DEVICE_IDENTIFIER_CHECK_PENDING, Device::RESPONSE_EXPECTED_ALWAYS_TRUE, Device::RESPONSE_EXPECTED_FALSE, Device::RESPONSE_EXPECTED_INVALID_FUNCTION_ID, Device::RESPONSE_EXPECTED_TRUE

Instance Attribute Summary

Attributes inherited from Device

#callback_formats, #expected_response_function_id, #expected_response_sequence_number, #high_level_callbacks, #registered_callbacks, #replaced, #uid

Instance Method Summary collapse

Methods inherited from Device

#check_validity, #dequeue_response, #enqueue_response, #get_api_version, #get_response_expected, #send_request, #set_response_expected, #set_response_expected_all

Constructor Details

#initialize(uid, ipcon) ⇒ BrickletGPSV3

Creates an object with the unique device ID uid and adds it to the IP Connection ipcon.



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 142

def initialize(uid, ipcon)
  super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME

  @api_version = [2, 0, 0]

  @response_expected[FUNCTION_GET_COORDINATES] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_ALTITUDE] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_MOTION] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_DATE_TIME] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_RESTART] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_GET_SATELLITE_SYSTEM_STATUS_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_SATELLITE_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_FIX_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_GET_FIX_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_COORDINATES_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
  @response_expected[FUNCTION_GET_COORDINATES_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_STATUS_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
  @response_expected[FUNCTION_GET_STATUS_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
  @response_expected[FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_MOTION_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
  @response_expected[FUNCTION_GET_MOTION_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
  @response_expected[FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_SBAS_CONFIG] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_GET_SBAS_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE

  @callback_formats[CALLBACK_PULSE_PER_SECOND] = [8, '']
  @callback_formats[CALLBACK_COORDINATES] = [18, 'L k L k']
  @callback_formats[CALLBACK_STATUS] = [10, '? C']
  @callback_formats[CALLBACK_ALTITUDE] = [16, 'l l']
  @callback_formats[CALLBACK_MOTION] = [16, 'L L']
  @callback_formats[CALLBACK_DATE_TIME] = [16, 'L L']

  @ipcon.add_device self
end

Instance Method Details

#get_altitudeObject

Returns the current altitude and corresponding geoidal separation.

This data is only valid if there is currently a fix as indicated by BrickletGPSV3#get_status.



221
222
223
224
225
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 221

def get_altitude
  check_validity

  send_request FUNCTION_GET_ALTITUDE, [], '', 16, 'l l'
end

#get_altitude_callback_periodObject

Returns the period as set by BrickletGPSV3#set_altitude_callback_period.



367
368
369
370
371
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 367

def get_altitude_callback_period
  check_validity

  send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 12, 'L'
end

#get_bootloader_modeObject

Returns the current bootloader mode, see BrickletGPSV3#set_bootloader_mode.



458
459
460
461
462
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 458

def get_bootloader_mode
  check_validity

  send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
end

#get_chip_temperatureObject

Returns the temperature as measured inside the microcontroller. The value returned is not the ambient temperature!

The temperature is only proportional to the real temperature and it has bad accuracy. Practically it is only useful as an indicator for temperature changes.



516
517
518
519
520
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 516

def get_chip_temperature
  check_validity

  send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
end

#get_coordinatesObject

Returns the GPS coordinates. Latitude and longitude are given in the “DD.dddddd°“ format, the value 57123468 means 57.123468°. The parameter “ns“ and “ew“ are the cardinal directions for latitude and longitude. Possible values for “ns“ and “ew“ are ‘N’, ‘S’, ‘E’ and ‘W’ (north, south, east and west).

This data is only valid if there is currently a fix as indicated by BrickletGPSV3#get_status.



200
201
202
203
204
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 200

def get_coordinates
  check_validity

  send_request FUNCTION_GET_COORDINATES, [], '', 18, 'L k L k'
end

#get_coordinates_callback_periodObject

Returns the period as set by BrickletGPSV3#set_coordinates_callback_period.



331
332
333
334
335
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 331

def get_coordinates_callback_period
  check_validity

  send_request FUNCTION_GET_COORDINATES_CALLBACK_PERIOD, [], '', 12, 'L'
end

#get_date_timeObject

Returns the current date and time. The date is given in the format “ddmmyy“ and the time is given in the format “hhmmss.sss“. For example, 140713 means 14.07.13 as date and 195923568 means 19:59:23.568 as time.



245
246
247
248
249
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 245

def get_date_time
  check_validity

  send_request FUNCTION_GET_DATE_TIME, [], '', 16, 'L L'
end

#get_date_time_callback_periodObject

Returns the period as set by BrickletGPSV3#set_date_time_callback_period.



403
404
405
406
407
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 403

def get_date_time_callback_period
  check_validity

  send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 12, 'L'
end

#get_fix_led_configObject

Returns the configuration as set by BrickletGPSV3#set_fix_led_config



313
314
315
316
317
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 313

def get_fix_led_config
  check_validity

  send_request FUNCTION_GET_FIX_LED_CONFIG, [], '', 9, 'C'
end

#get_identityObject

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be ‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’ or ‘h’ (Bricklet Port). A Bricklet connected to an :ref:‘Isolator Bricklet <isolator_bricklet>` is always at position ’z’.

The device identifier numbers can be found :ref:‘here <device_identifier>`. |device_identifier_constant|



563
564
565
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 563

def get_identity
  send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
end

#get_motionObject

Returns the current course and speed. A course of 0° means the Bricklet is traveling north bound and 90° means it is traveling east bound.

Please note that this only returns useful values if an actual movement is present.

This data is only valid if there is currently a fix as indicated by BrickletGPSV3#get_status.



235
236
237
238
239
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 235

def get_motion
  check_validity

  send_request FUNCTION_GET_MOTION, [], '', 16, 'L L'
end

#get_motion_callback_periodObject

Returns the period as set by BrickletGPSV3#set_motion_callback_period.



385
386
387
388
389
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 385

def get_motion_callback_period
  check_validity

  send_request FUNCTION_GET_MOTION_CALLBACK_PERIOD, [], '', 12, 'L'
end

#get_satellite_status(satellite_system, satellite_number) ⇒ Object

Returns the current elevation, azimuth and SNR for a given satellite and satellite system.

The satellite number here always goes from 1 to 32. For GLONASS it corresponds to the satellites 65-96.

Galileo is not yet supported.



292
293
294
295
296
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 292

def get_satellite_status(satellite_system, satellite_number)
  check_validity

  send_request FUNCTION_GET_SATELLITE_STATUS, [satellite_system, satellite_number], 'C C', 14, 's s s'
end

#get_satellite_system_status(satellite_system) ⇒ Object

Returns the

  • satellite numbers list (up to 12 items)

  • fix value,

  • PDOP value,

  • HDOP value and

  • VDOP value

for a given satellite system. Currently GPS and GLONASS are supported, Galileo is not yet supported.

The GPS and GLONASS satellites have unique numbers and the satellite list gives the numbers of the satellites that are currently utilized. The number 0 is not a valid satellite number and can be ignored in the list.



581
582
583
584
585
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 581

def get_satellite_system_status(satellite_system)
  ret = get_satellite_system_status_low_level satellite_system

  [ret[1][0, ret[0]], ret[2], ret[3], ret[4], ret[5]]
end

#get_satellite_system_status_low_level(satellite_system) ⇒ Object

Returns the

  • satellite numbers list (up to 12 items)

  • fix value,

  • PDOP value,

  • HDOP value and

  • VDOP value

for a given satellite system. Currently GPS and GLONASS are supported, Galileo is not yet supported.

The GPS and GLONASS satellites have unique numbers and the satellite list gives the numbers of the satellites that are currently utilized. The number 0 is not a valid satellite number and can be ignored in the list.



279
280
281
282
283
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 279

def get_satellite_system_status_low_level(satellite_system)
  check_validity

  send_request FUNCTION_GET_SATELLITE_SYSTEM_STATUS_LOW_LEVEL, [satellite_system], 'C', 28, 'C C12 C S S S'
end

#get_sbas_configObject

Returns the SBAS configuration as set by BrickletGPSV3#set_sbas_config



419
420
421
422
423
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 419

def get_sbas_config
  check_validity

  send_request FUNCTION_GET_SBAS_CONFIG, [], '', 9, 'C'
end

#get_spitfp_error_countObject

Returns the error count for the communication between Brick and Bricklet.

The errors are divided into

  • ACK checksum errors,

  • message checksum errors,

  • framing errors and

  • overflow errors.

The errors counts are for errors that occur on the Bricklet side. All Bricks have a similar function that returns the errors on the Brick side.



436
437
438
439
440
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 436

def get_spitfp_error_count
  check_validity

  send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
end

#get_statusObject

Returns if a fix is currently available as well as the number of satellites that are in view.

There is also a :ref:‘green LED <gps_v2_bricklet_fix_led>` on the Bricklet that indicates the fix status.



211
212
213
214
215
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 211

def get_status
  check_validity

  send_request FUNCTION_GET_STATUS, [], '', 10, '? C'
end

#get_status_callback_periodObject

Returns the period as set by BrickletGPSV3#set_status_callback_period.



349
350
351
352
353
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 349

def get_status_callback_period
  check_validity

  send_request FUNCTION_GET_STATUS_CALLBACK_PERIOD, [], '', 12, 'L'
end

#get_status_led_configObject

Returns the configuration as set by BrickletGPSV3#set_status_led_config



504
505
506
507
508
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 504

def get_status_led_config
  check_validity

  send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
end

#read_uidObject

Returns the current UID as an integer. Encode as Base58 to get the usual string version.



547
548
549
550
551
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 547

def read_uid
  check_validity

  send_request FUNCTION_READ_UID, [], '', 12, 'L'
end

#register_callback(id, &block) ⇒ Object

Registers a callback with ID id to the block block.



588
589
590
591
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 588

def register_callback(id, &block)
  callback = block
  @registered_callbacks[id] = callback
end

#resetObject

Calling this function will reset the Bricklet. All configurations will be lost.

After a reset you have to create new device objects, calling functions on the existing ones will result in undefined behavior!



528
529
530
531
532
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 528

def reset
  check_validity

  send_request FUNCTION_RESET, [], '', 8, ''
end

#restart(restart_type) ⇒ Object

Restarts the GPS Bricklet, the following restart types are available:

"Value", "Description"

"0", "Hot start (use all available data in the NV store)"
"1", "Warm start (don't use ephemeris at restart)"
"2", "Cold start (don't use time, position, almanacs and ephemeris at restart)"
"3", "Factory reset (clear all system/user configurations at restart)"


259
260
261
262
263
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 259

def restart(restart_type)
  check_validity

  send_request FUNCTION_RESTART, [restart_type], 'C', 8, ''
end

#set_altitude_callback_period(period) ⇒ Object

Sets the period with which the CALLBACK_ALTITUDE callback is triggered periodically. A value of 0 turns the callback off.

The CALLBACK_ALTITUDE callback is only triggered if the altitude changed since the last triggering.



360
361
362
363
364
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 360

def set_altitude_callback_period(period)
  check_validity

  send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 8, ''
end

#set_bootloader_mode(mode) ⇒ Object

Sets the bootloader mode and returns the status after the requested mode change was instigated.

You can change from bootloader mode to firmware mode and vice versa. A change from bootloader mode to firmware mode will only take place if the entry function, device identifier and CRC are present and correct.

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.



451
452
453
454
455
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 451

def set_bootloader_mode(mode)
  check_validity

  send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
end

#set_coordinates_callback_period(period) ⇒ Object

Sets the period with which the CALLBACK_COORDINATES callback is triggered periodically. A value of 0 turns the callback off.

The CALLBACK_COORDINATES callback is only triggered if the coordinates changed since the last triggering.



324
325
326
327
328
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 324

def set_coordinates_callback_period(period)
  check_validity

  send_request FUNCTION_SET_COORDINATES_CALLBACK_PERIOD, [period], 'L', 8, ''
end

#set_date_time_callback_period(period) ⇒ Object

Sets the period with which the CALLBACK_DATE_TIME callback is triggered periodically. A value of 0 turns the callback off.

The CALLBACK_DATE_TIME callback is only triggered if the date or time changed since the last triggering.



396
397
398
399
400
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 396

def set_date_time_callback_period(period)
  check_validity

  send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 8, ''
end

#set_fix_led_config(config) ⇒ Object

Sets the fix LED configuration. By default the LED shows if the Bricklet got a GPS fix yet. If a fix is established the LED turns on. If there is no fix then the LED is turned off.

You can also turn the LED permanently on/off, show a heartbeat or let it blink in sync with the PPS (pulse per second) output of the GPS module.

If the Bricklet is in bootloader mode, the LED is off.



306
307
308
309
310
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 306

def set_fix_led_config(config)
  check_validity

  send_request FUNCTION_SET_FIX_LED_CONFIG, [config], 'C', 8, ''
end

#set_motion_callback_period(period) ⇒ Object

Sets the period with which the CALLBACK_MOTION callback is triggered periodically. A value of 0 turns the callback off.

The CALLBACK_MOTION callback is only triggered if the motion changed since the last triggering.



378
379
380
381
382
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 378

def set_motion_callback_period(period)
  check_validity

  send_request FUNCTION_SET_MOTION_CALLBACK_PERIOD, [period], 'L', 8, ''
end

#set_sbas_config(sbas_config) ⇒ Object

If ‘SBAS <en.wikipedia.org/wiki/GNSS_augmentation#Satellite-based_augmentation_system>`__ is enabled, the position accuracy increases (if SBAS satellites are in view), but the update rate is limited to 5Hz. With SBAS disabled the update rate is increased to 10Hz.



412
413
414
415
416
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 412

def set_sbas_config(sbas_config)
  check_validity

  send_request FUNCTION_SET_SBAS_CONFIG, [sbas_config], 'C', 8, ''
end

#set_status_callback_period(period) ⇒ Object

Sets the period with which the CALLBACK_STATUS callback is triggered periodically. A value of 0 turns the callback off.

The CALLBACK_STATUS callback is only triggered if the status changed since the last triggering.



342
343
344
345
346
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 342

def set_status_callback_period(period)
  check_validity

  send_request FUNCTION_SET_STATUS_CALLBACK_PERIOD, [period], 'L', 8, ''
end

#set_status_led_config(config) ⇒ Object

Sets the status LED configuration. By default the LED shows communication traffic between Brick and Bricklet, it flickers once for every 10 received data packets.

You can also turn the LED permanently on/off or show a heartbeat.

If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.



497
498
499
500
501
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 497

def set_status_led_config(config)
  check_validity

  send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
end

#set_write_firmware_pointer(pointer) ⇒ Object

Sets the firmware pointer for BrickletGPSV3#write_firmware. The pointer has to be increased by chunks of size 64. The data is written to flash every 4 chunks (which equals to one page of size 256).

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.



470
471
472
473
474
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 470

def set_write_firmware_pointer(pointer)
  check_validity

  send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
end

#write_firmware(data) ⇒ Object

Writes 64 Bytes of firmware at the position as written by BrickletGPSV3#set_write_firmware_pointer before. The firmware is written to flash every 4 chunks.

You can only write firmware in bootloader mode.

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.



484
485
486
487
488
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 484

def write_firmware(data)
  check_validity

  send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
end

#write_uid(uid) ⇒ Object

Writes a new UID into flash. If you want to set a new UID you have to decode the Base58 encoded UID string into an integer first.

We recommend that you use Brick Viewer to change the UID.



539
540
541
542
543
# File 'lib/tinkerforge/bricklet_gps_v3.rb', line 539

def write_uid(uid)
  check_validity

  send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
end