tinkerforge 2.1.13 → 2.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tinkerforge/brick_dc.rb +122 -34
- data/lib/tinkerforge/brick_imu.rb +135 -49
- data/lib/tinkerforge/brick_imu_v2.rb +137 -54
- data/lib/tinkerforge/brick_master.rb +206 -120
- data/lib/tinkerforge/brick_red.rb +64 -69
- data/lib/tinkerforge/brick_servo.rb +133 -44
- data/lib/tinkerforge/brick_silent_stepper.rb +151 -65
- data/lib/tinkerforge/brick_stepper.rb +139 -51
- data/lib/tinkerforge/bricklet_accelerometer.rb +17 -18
- data/lib/tinkerforge/bricklet_ambient_light.rb +16 -19
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +13 -14
- data/lib/tinkerforge/bricklet_analog_in.rb +20 -23
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +18 -21
- data/lib/tinkerforge/bricklet_analog_out.rb +8 -7
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +7 -6
- data/lib/tinkerforge/bricklet_barometer.rb +21 -24
- data/lib/tinkerforge/bricklet_can.rb +14 -14
- data/lib/tinkerforge/bricklet_co2.rb +11 -12
- data/lib/tinkerforge/bricklet_color.rb +22 -25
- data/lib/tinkerforge/bricklet_current12.rb +18 -22
- data/lib/tinkerforge/bricklet_current25.rb +18 -22
- data/lib/tinkerforge/bricklet_distance_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_distance_us.rb +13 -14
- data/lib/tinkerforge/bricklet_dual_button.rb +8 -8
- data/lib/tinkerforge/bricklet_dual_relay.rb +9 -9
- data/lib/tinkerforge/bricklet_dust_detector.rb +13 -14
- data/lib/tinkerforge/bricklet_gps.rb +21 -25
- data/lib/tinkerforge/bricklet_gps_v2.rb +56 -41
- data/lib/tinkerforge/bricklet_hall_effect.rb +13 -13
- data/lib/tinkerforge/bricklet_humidity.rb +16 -19
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +13 -12
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +15 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +12 -12
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +13 -14
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +16 -17
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +12 -12
- data/lib/tinkerforge/bricklet_io16.rb +18 -19
- data/lib/tinkerforge/bricklet_io4.rb +18 -19
- data/lib/tinkerforge/bricklet_joystick.rb +18 -23
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +26 -29
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +14 -15
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +18 -19
- data/lib/tinkerforge/bricklet_led_strip.rb +20 -20
- data/lib/tinkerforge/bricklet_line.rb +11 -12
- data/lib/tinkerforge/bricklet_linear_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_load_cell.rb +20 -21
- data/lib/tinkerforge/bricklet_moisture.rb +13 -14
- data/lib/tinkerforge/bricklet_motion_detector.rb +7 -8
- data/lib/tinkerforge/bricklet_multi_touch.rb +10 -10
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +11 -11
- data/lib/tinkerforge/bricklet_oled_128x64.rb +10 -9
- data/lib/tinkerforge/bricklet_oled_64x48.rb +10 -9
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +6 -7
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +7 -8
- data/lib/tinkerforge/bricklet_ptc.rb +23 -26
- data/lib/tinkerforge/bricklet_real_time_clock.rb +13 -14
- data/lib/tinkerforge/bricklet_remote_switch.rb +12 -12
- data/lib/tinkerforge/bricklet_rgb_led.rb +6 -5
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +12 -15
- data/lib/tinkerforge/bricklet_rotary_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_rs232.rb +12 -13
- data/lib/tinkerforge/bricklet_rs485.rb +1373 -0
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +8 -8
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +8 -8
- data/lib/tinkerforge/bricklet_sound_intensity.rb +11 -12
- data/lib/tinkerforge/bricklet_temperature.rb +13 -14
- data/lib/tinkerforge/bricklet_temperature_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_thermocouple.rb +14 -16
- data/lib/tinkerforge/bricklet_tilt.rb +8 -8
- data/lib/tinkerforge/bricklet_uv_light.rb +11 -12
- data/lib/tinkerforge/bricklet_voltage.rb +16 -19
- data/lib/tinkerforge/bricklet_voltage_current.rb +25 -30
- data/lib/tinkerforge/ip_connection.rb +207 -138
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
@@ -245,9 +245,6 @@ module Tinkerforge
|
|
245
245
|
@response_expected[FUNCTION_GET_FILE_POSITION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
246
246
|
@response_expected[FUNCTION_SET_FILE_EVENTS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
247
247
|
@response_expected[FUNCTION_GET_FILE_EVENTS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
248
|
-
@response_expected[CALLBACK_ASYNC_FILE_READ] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
249
|
-
@response_expected[CALLBACK_ASYNC_FILE_WRITE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
250
|
-
@response_expected[CALLBACK_FILE_EVENTS_OCCURRED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
251
248
|
@response_expected[FUNCTION_OPEN_DIRECTORY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
252
249
|
@response_expected[FUNCTION_GET_DIRECTORY_NAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
253
250
|
@response_expected[FUNCTION_GET_NEXT_DIRECTORY_ENTRY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -260,7 +257,6 @@ module Tinkerforge
|
|
260
257
|
@response_expected[FUNCTION_GET_PROCESS_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
261
258
|
@response_expected[FUNCTION_GET_PROCESS_STDIO] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
262
259
|
@response_expected[FUNCTION_GET_PROCESS_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
263
|
-
@response_expected[CALLBACK_PROCESS_STATE_CHANGED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
264
260
|
@response_expected[FUNCTION_GET_PROGRAMS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
265
261
|
@response_expected[FUNCTION_DEFINE_PROGRAM] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
266
262
|
@response_expected[FUNCTION_PURGE_PROGRAM] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -280,8 +276,6 @@ module Tinkerforge
|
|
280
276
|
@response_expected[FUNCTION_SET_CUSTOM_PROGRAM_OPTION_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
281
277
|
@response_expected[FUNCTION_GET_CUSTOM_PROGRAM_OPTION_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
282
278
|
@response_expected[FUNCTION_REMOVE_CUSTOM_PROGRAM_OPTION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
283
|
-
@response_expected[CALLBACK_PROGRAM_SCHEDULER_STATE_CHANGED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
284
|
-
@response_expected[CALLBACK_PROGRAM_PROCESS_SPAWNED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
285
279
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
286
280
|
|
287
281
|
@callback_formats[CALLBACK_ASYNC_FILE_READ] = 'S C C60 C'
|
@@ -290,37 +284,38 @@ module Tinkerforge
|
|
290
284
|
@callback_formats[CALLBACK_PROCESS_STATE_CHANGED] = 'S C Q C'
|
291
285
|
@callback_formats[CALLBACK_PROGRAM_SCHEDULER_STATE_CHANGED] = 'S'
|
292
286
|
@callback_formats[CALLBACK_PROGRAM_PROCESS_SPAWNED] = 'S'
|
287
|
+
|
293
288
|
end
|
294
289
|
|
295
290
|
#
|
296
291
|
def create_session(lifetime)
|
297
|
-
send_request
|
292
|
+
send_request FUNCTION_CREATE_SESSION, [lifetime], 'L', 3, 'C S'
|
298
293
|
end
|
299
294
|
|
300
295
|
#
|
301
296
|
def expire_session(session_id)
|
302
|
-
send_request
|
297
|
+
send_request FUNCTION_EXPIRE_SESSION, [session_id], 'S', 1, 'C'
|
303
298
|
end
|
304
299
|
|
305
300
|
#
|
306
301
|
def expire_session_unchecked(session_id)
|
307
|
-
send_request
|
302
|
+
send_request FUNCTION_EXPIRE_SESSION_UNCHECKED, [session_id], 'S', 0, ''
|
308
303
|
end
|
309
304
|
|
310
305
|
#
|
311
306
|
def keep_session_alive(session_id, lifetime)
|
312
|
-
send_request
|
307
|
+
send_request FUNCTION_KEEP_SESSION_ALIVE, [session_id, lifetime], 'S L', 1, 'C'
|
313
308
|
end
|
314
309
|
|
315
310
|
# Decreases the reference count of an object by one and returns the resulting
|
316
311
|
# error code. If the reference count reaches zero the object gets destroyed.
|
317
312
|
def release_object(object_id, session_id)
|
318
|
-
send_request
|
313
|
+
send_request FUNCTION_RELEASE_OBJECT, [object_id, session_id], 'S S', 1, 'C'
|
319
314
|
end
|
320
315
|
|
321
316
|
#
|
322
317
|
def release_object_unchecked(object_id, session_id)
|
323
|
-
send_request
|
318
|
+
send_request FUNCTION_RELEASE_OBJECT_UNCHECKED, [object_id, session_id], 'S S', 0, ''
|
324
319
|
end
|
325
320
|
|
326
321
|
# Allocates a new string object, reserves ``length_to_reserve`` bytes memory
|
@@ -329,31 +324,31 @@ module Tinkerforge
|
|
329
324
|
#
|
330
325
|
# Returns the object ID of the new string object and the resulting error code.
|
331
326
|
def allocate_string(length_to_reserve, buffer, session_id)
|
332
|
-
send_request
|
327
|
+
send_request FUNCTION_ALLOCATE_STRING, [length_to_reserve, buffer, session_id], 'L Z58 S', 3, 'C S'
|
333
328
|
end
|
334
329
|
|
335
330
|
# Truncates a string object to ``length`` bytes and returns the resulting
|
336
331
|
# error code.
|
337
332
|
def truncate_string(string_id, length)
|
338
|
-
send_request
|
333
|
+
send_request FUNCTION_TRUNCATE_STRING, [string_id, length], 'S L', 1, 'C'
|
339
334
|
end
|
340
335
|
|
341
336
|
# Returns the length of a string object in bytes and the resulting error code.
|
342
337
|
def get_string_length(string_id)
|
343
|
-
send_request
|
338
|
+
send_request FUNCTION_GET_STRING_LENGTH, [string_id], 'S', 5, 'C L'
|
344
339
|
end
|
345
340
|
|
346
341
|
# Sets a chunk of up to 58 bytes in a string object beginning at ``offset``.
|
347
342
|
#
|
348
343
|
# Returns the resulting error code.
|
349
344
|
def set_string_chunk(string_id, offset, buffer)
|
350
|
-
send_request
|
345
|
+
send_request FUNCTION_SET_STRING_CHUNK, [string_id, offset, buffer], 'S L Z58', 1, 'C'
|
351
346
|
end
|
352
347
|
|
353
348
|
# Returns a chunk up to 63 bytes from a string object beginning at ``offset`` and
|
354
349
|
# returns the resulting error code.
|
355
350
|
def get_string_chunk(string_id, offset)
|
356
|
-
send_request
|
351
|
+
send_request FUNCTION_GET_STRING_CHUNK, [string_id, offset], 'S L', 64, 'C Z63'
|
357
352
|
end
|
358
353
|
|
359
354
|
# Allocates a new list object and reserves memory for ``length_to_reserve``
|
@@ -365,12 +360,12 @@ module Tinkerforge
|
|
365
360
|
# When a list object gets destroyed then the reference count of each object in
|
366
361
|
# the list object is decreased by one.
|
367
362
|
def allocate_list(length_to_reserve, session_id)
|
368
|
-
send_request
|
363
|
+
send_request FUNCTION_ALLOCATE_LIST, [length_to_reserve, session_id], 'S S', 3, 'C S'
|
369
364
|
end
|
370
365
|
|
371
366
|
# Returns the length of a list object in items and the resulting error code.
|
372
367
|
def get_list_length(list_id)
|
373
|
-
send_request
|
368
|
+
send_request FUNCTION_GET_LIST_LENGTH, [list_id], 'S', 3, 'C S'
|
374
369
|
end
|
375
370
|
|
376
371
|
# Returns the object ID and type of the object stored at ``index`` in a list
|
@@ -385,7 +380,7 @@ module Tinkerforge
|
|
385
380
|
# * Process = 4
|
386
381
|
# * Program = 5
|
387
382
|
def get_list_item(list_id, index, session_id)
|
388
|
-
send_request
|
383
|
+
send_request FUNCTION_GET_LIST_ITEM, [list_id, index, session_id], 'S S S', 4, 'C S C'
|
389
384
|
end
|
390
385
|
|
391
386
|
# Appends an object to a list object and increases the reference count of the
|
@@ -393,7 +388,7 @@ module Tinkerforge
|
|
393
388
|
#
|
394
389
|
# Returns the resulting error code.
|
395
390
|
def append_to_list(list_id, item_object_id)
|
396
|
-
send_request
|
391
|
+
send_request FUNCTION_APPEND_TO_LIST, [list_id, item_object_id], 'S S', 1, 'C'
|
397
392
|
end
|
398
393
|
|
399
394
|
# Removes the object stored at ``index`` from a list object and decreases the
|
@@ -401,7 +396,7 @@ module Tinkerforge
|
|
401
396
|
#
|
402
397
|
# Returns the resulting error code.
|
403
398
|
def remove_from_list(list_id, index)
|
404
|
-
send_request
|
399
|
+
send_request FUNCTION_REMOVE_FROM_LIST, [list_id, index], 'S S', 1, 'C'
|
405
400
|
end
|
406
401
|
|
407
402
|
# Opens an existing file or creates a new file and allocates a new file object
|
@@ -446,7 +441,7 @@ module Tinkerforge
|
|
446
441
|
#
|
447
442
|
# Returns the object ID of the new file object and the resulting error code.
|
448
443
|
def open_file(name_string_id, flags, permissions, uid, gid, session_id)
|
449
|
-
send_request
|
444
|
+
send_request FUNCTION_OPEN_FILE, [name_string_id, flags, permissions, uid, gid, session_id], 'S L S L L S', 3, 'C S'
|
450
445
|
end
|
451
446
|
|
452
447
|
# Creates a new pipe and allocates a new file object for it.
|
@@ -462,7 +457,7 @@ module Tinkerforge
|
|
462
457
|
#
|
463
458
|
# Returns the object ID of the new file object and the resulting error code.
|
464
459
|
def create_pipe(flags, length, session_id)
|
465
|
-
send_request
|
460
|
+
send_request FUNCTION_CREATE_PIPE, [flags, length, session_id], 'L Q S', 3, 'C S'
|
466
461
|
end
|
467
462
|
|
468
463
|
# Returns various information about a file and the resulting error code.
|
@@ -489,7 +484,7 @@ module Tinkerforge
|
|
489
484
|
#
|
490
485
|
# FIXME: everything except flags and length is invalid if file type is *Pipe*
|
491
486
|
def get_file_info(file_id, session_id)
|
492
|
-
send_request
|
487
|
+
send_request FUNCTION_GET_FILE_INFO, [file_id, session_id], 'S S', 50, 'C C S L S L L Q Q Q Q'
|
493
488
|
end
|
494
489
|
|
495
490
|
# Reads up to 62 bytes from a file object.
|
@@ -505,7 +500,7 @@ module Tinkerforge
|
|
505
500
|
# flag or by BrickRED#create_pipe without the *NonBlockingRead* flag then the
|
506
501
|
# error code *NotSupported* is returned.
|
507
502
|
def read_file(file_id, length_to_read)
|
508
|
-
send_request
|
503
|
+
send_request FUNCTION_READ_FILE, [file_id, length_to_read], 'S C', 64, 'C C62 C'
|
509
504
|
end
|
510
505
|
|
511
506
|
# Reads up to 2\ :sup:`63`\ - 1 bytes from a file object asynchronously.
|
@@ -521,7 +516,7 @@ module Tinkerforge
|
|
521
516
|
# flag or by BrickRED#create_pipe without the *NonBlockingRead* flag then the error
|
522
517
|
# code *NotSupported* is reported via the CALLBACK_ASYNC_FILE_READ callback.
|
523
518
|
def read_file_async(file_id, length_to_read)
|
524
|
-
send_request
|
519
|
+
send_request FUNCTION_READ_FILE_ASYNC, [file_id, length_to_read], 'S Q', 0, ''
|
525
520
|
end
|
526
521
|
|
527
522
|
# Aborts a BrickRED#read_file_async operation in progress.
|
@@ -530,7 +525,7 @@ module Tinkerforge
|
|
530
525
|
#
|
531
526
|
# On success the CALLBACK_ASYNC_FILE_READ callback will report *OperationAborted*.
|
532
527
|
def abort_async_file_read(file_id)
|
533
|
-
send_request
|
528
|
+
send_request FUNCTION_ABORT_ASYNC_FILE_READ, [file_id], 'S', 1, 'C'
|
534
529
|
end
|
535
530
|
|
536
531
|
# Writes up to 61 bytes to a file object.
|
@@ -541,7 +536,7 @@ module Tinkerforge
|
|
541
536
|
# flag or by BrickRED#create_pipe without the *NonBlockingWrite* flag then the
|
542
537
|
# error code *NotSupported* is returned.
|
543
538
|
def write_file(file_id, buffer, length_to_write)
|
544
|
-
send_request
|
539
|
+
send_request FUNCTION_WRITE_FILE, [file_id, buffer, length_to_write], 'S C61 C', 2, 'C C'
|
545
540
|
end
|
546
541
|
|
547
542
|
# Writes up to 61 bytes to a file object.
|
@@ -553,7 +548,7 @@ module Tinkerforge
|
|
553
548
|
# flag or by BrickRED#create_pipe without the *NonBlockingWrite* flag then the
|
554
549
|
# write operation will fail silently.
|
555
550
|
def write_file_unchecked(file_id, buffer, length_to_write)
|
556
|
-
send_request
|
551
|
+
send_request FUNCTION_WRITE_FILE_UNCHECKED, [file_id, buffer, length_to_write], 'S C61 C', 0, ''
|
557
552
|
end
|
558
553
|
|
559
554
|
# Writes up to 61 bytes to a file object.
|
@@ -565,7 +560,7 @@ module Tinkerforge
|
|
565
560
|
# flag or by BrickRED#create_pipe without the *NonBlockingWrite* flag then the
|
566
561
|
# error code *NotSupported* is reported via the CALLBACK_ASYNC_FILE_WRITE callback.
|
567
562
|
def write_file_async(file_id, buffer, length_to_write)
|
568
|
-
send_request
|
563
|
+
send_request FUNCTION_WRITE_FILE_ASYNC, [file_id, buffer, length_to_write], 'S C61 C', 0, ''
|
569
564
|
end
|
570
565
|
|
571
566
|
# Set the current seek position of a file object in bytes relative to ``origin``.
|
@@ -581,7 +576,7 @@ module Tinkerforge
|
|
581
576
|
# If the file object was created by BrickRED#create_pipe then it has no seek
|
582
577
|
# position and the error code *InvalidSeek* is returned.
|
583
578
|
def set_file_position(file_id, offset, origin)
|
584
|
-
send_request
|
579
|
+
send_request FUNCTION_SET_FILE_POSITION, [file_id, offset, origin], 'S q C', 9, 'C Q'
|
585
580
|
end
|
586
581
|
|
587
582
|
# Returns the current seek position of a file object in bytes and returns the
|
@@ -590,17 +585,17 @@ module Tinkerforge
|
|
590
585
|
# If the file object was created by BrickRED#create_pipe then it has no seek
|
591
586
|
# position and the error code *InvalidSeek* is returned.
|
592
587
|
def get_file_position(file_id)
|
593
|
-
send_request
|
588
|
+
send_request FUNCTION_GET_FILE_POSITION, [file_id], 'S', 9, 'C Q'
|
594
589
|
end
|
595
590
|
|
596
591
|
#
|
597
592
|
def set_file_events(file_id, events)
|
598
|
-
send_request
|
593
|
+
send_request FUNCTION_SET_FILE_EVENTS, [file_id, events], 'S S', 1, 'C'
|
599
594
|
end
|
600
595
|
|
601
596
|
#
|
602
597
|
def get_file_events(file_id)
|
603
|
-
send_request
|
598
|
+
send_request FUNCTION_GET_FILE_EVENTS, [file_id], 'S', 3, 'C S'
|
604
599
|
end
|
605
600
|
|
606
601
|
# Opens an existing directory and allocates a new directory object for it.
|
@@ -614,13 +609,13 @@ module Tinkerforge
|
|
614
609
|
#
|
615
610
|
# Returns the object ID of the new directory object and the resulting error code.
|
616
611
|
def open_directory(name_string_id, session_id)
|
617
|
-
send_request
|
612
|
+
send_request FUNCTION_OPEN_DIRECTORY, [name_string_id, session_id], 'S S', 3, 'C S'
|
618
613
|
end
|
619
614
|
|
620
615
|
# Returns the name of a directory object, as passed to BrickRED#open_directory, and
|
621
616
|
# the resulting error code.
|
622
617
|
def get_directory_name(directory_id, session_id)
|
623
|
-
send_request
|
618
|
+
send_request FUNCTION_GET_DIRECTORY_NAME, [directory_id, session_id], 'S S', 3, 'C S'
|
624
619
|
end
|
625
620
|
|
626
621
|
# Returns the next entry in a directory object and the resulting error code.
|
@@ -639,27 +634,27 @@ module Tinkerforge
|
|
639
634
|
# * Symlink = 6
|
640
635
|
# * Socket = 7
|
641
636
|
def get_next_directory_entry(directory_id, session_id)
|
642
|
-
send_request
|
637
|
+
send_request FUNCTION_GET_NEXT_DIRECTORY_ENTRY, [directory_id, session_id], 'S S', 4, 'C S C'
|
643
638
|
end
|
644
639
|
|
645
640
|
# Rewinds a directory object and returns the resulting error code.
|
646
641
|
def rewind_directory(directory_id)
|
647
|
-
send_request
|
642
|
+
send_request FUNCTION_REWIND_DIRECTORY, [directory_id], 'S', 1, 'C'
|
648
643
|
end
|
649
644
|
|
650
645
|
# FIXME: name has to be absolute
|
651
646
|
def create_directory(name_string_id, flags, permissions, uid, gid)
|
652
|
-
send_request
|
647
|
+
send_request FUNCTION_CREATE_DIRECTORY, [name_string_id, flags, permissions, uid, gid], 'S L S L L', 1, 'C'
|
653
648
|
end
|
654
649
|
|
655
650
|
#
|
656
651
|
def get_processes(session_id)
|
657
|
-
send_request
|
652
|
+
send_request FUNCTION_GET_PROCESSES, [session_id], 'S', 3, 'C S'
|
658
653
|
end
|
659
654
|
|
660
655
|
#
|
661
656
|
def spawn_process(executable_string_id, arguments_list_id, environment_list_id, working_directory_string_id, uid, gid, stdin_file_id, stdout_file_id, stderr_file_id, session_id)
|
662
|
-
send_request
|
657
|
+
send_request FUNCTION_SPAWN_PROCESS, [executable_string_id, arguments_list_id, environment_list_id, working_directory_string_id, uid, gid, stdin_file_id, stdout_file_id, stderr_file_id, session_id], 'S S S S L L S S S S', 3, 'C S'
|
663
658
|
end
|
664
659
|
|
665
660
|
# Sends a UNIX signal to a process object and returns the resulting error code.
|
@@ -676,14 +671,14 @@ module Tinkerforge
|
|
676
671
|
# * Continue = 18
|
677
672
|
# * Stop = 19
|
678
673
|
def kill_process(process_id, signal)
|
679
|
-
send_request
|
674
|
+
send_request FUNCTION_KILL_PROCESS, [process_id, signal], 'S C', 1, 'C'
|
680
675
|
end
|
681
676
|
|
682
677
|
# Returns the executable, arguments, environment and working directory used to
|
683
678
|
# spawn a process object, as passed to BrickRED#spawn_process, and the resulting
|
684
679
|
# error code.
|
685
680
|
def get_process_command(process_id, session_id)
|
686
|
-
send_request
|
681
|
+
send_request FUNCTION_GET_PROCESS_COMMAND, [process_id, session_id], 'S S', 9, 'C S S S S'
|
687
682
|
end
|
688
683
|
|
689
684
|
# Returns the process ID and the user and group ID used to spawn a process object,
|
@@ -692,13 +687,13 @@ module Tinkerforge
|
|
692
687
|
# The process ID is only valid if the state is *Running* or *Stopped*, see
|
693
688
|
# BrickRED#get_process_state.
|
694
689
|
def get_process_identity(process_id)
|
695
|
-
send_request
|
690
|
+
send_request FUNCTION_GET_PROCESS_IDENTITY, [process_id], 'S', 13, 'C L L L'
|
696
691
|
end
|
697
692
|
|
698
693
|
# Returns the stdin, stdout and stderr files used to spawn a process object, as
|
699
694
|
# passed to BrickRED#spawn_process, and the resulting error code.
|
700
695
|
def get_process_stdio(process_id, session_id)
|
701
|
-
send_request
|
696
|
+
send_request FUNCTION_GET_PROCESS_STDIO, [process_id, session_id], 'S S', 7, 'C S S S'
|
702
697
|
end
|
703
698
|
|
704
699
|
# Returns the current state, timestamp and exit code of a process object, and
|
@@ -733,102 +728,102 @@ module Tinkerforge
|
|
733
728
|
# The *CannotExecute* error can be caused by the executable being opened for
|
734
729
|
# writing.
|
735
730
|
def get_process_state(process_id)
|
736
|
-
send_request
|
731
|
+
send_request FUNCTION_GET_PROCESS_STATE, [process_id], 'S', 11, 'C C Q C'
|
737
732
|
end
|
738
733
|
|
739
734
|
#
|
740
735
|
def get_programs(session_id)
|
741
|
-
send_request
|
736
|
+
send_request FUNCTION_GET_PROGRAMS, [session_id], 'S', 3, 'C S'
|
742
737
|
end
|
743
738
|
|
744
739
|
#
|
745
740
|
def define_program(identifier_string_id, session_id)
|
746
|
-
send_request
|
741
|
+
send_request FUNCTION_DEFINE_PROGRAM, [identifier_string_id, session_id], 'S S', 3, 'C S'
|
747
742
|
end
|
748
743
|
|
749
744
|
#
|
750
745
|
def purge_program(program_id, cookie)
|
751
|
-
send_request
|
746
|
+
send_request FUNCTION_PURGE_PROGRAM, [program_id, cookie], 'S L', 1, 'C'
|
752
747
|
end
|
753
748
|
|
754
749
|
#
|
755
750
|
def get_program_identifier(program_id, session_id)
|
756
|
-
send_request
|
751
|
+
send_request FUNCTION_GET_PROGRAM_IDENTIFIER, [program_id, session_id], 'S S', 3, 'C S'
|
757
752
|
end
|
758
753
|
|
759
754
|
# FIXME: root directory is absolute: <home>/programs/<identifier>
|
760
755
|
def get_program_root_directory(program_id, session_id)
|
761
|
-
send_request
|
756
|
+
send_request FUNCTION_GET_PROGRAM_ROOT_DIRECTORY, [program_id, session_id], 'S S', 3, 'C S'
|
762
757
|
end
|
763
758
|
|
764
759
|
# FIXME: working directory is relative to <home>/programs/<identifier>/bin
|
765
760
|
def set_program_command(program_id, executable_string_id, arguments_list_id, environment_list_id, working_directory_string_id)
|
766
|
-
send_request
|
761
|
+
send_request FUNCTION_SET_PROGRAM_COMMAND, [program_id, executable_string_id, arguments_list_id, environment_list_id, working_directory_string_id], 'S S S S S', 1, 'C'
|
767
762
|
end
|
768
763
|
|
769
764
|
# FIXME: working directory is relative to <home>/programs/<identifier>/bin
|
770
765
|
def get_program_command(program_id, session_id)
|
771
|
-
send_request
|
766
|
+
send_request FUNCTION_GET_PROGRAM_COMMAND, [program_id, session_id], 'S S', 9, 'C S S S S'
|
772
767
|
end
|
773
768
|
|
774
769
|
# FIXME: stdio file names are relative to <home>/programs/<identifier>/bin
|
775
770
|
def set_program_stdio_redirection(program_id, stdin_redirection, stdin_file_name_string_id, stdout_redirection, stdout_file_name_string_id, stderr_redirection, stderr_file_name_string_id)
|
776
|
-
send_request
|
771
|
+
send_request FUNCTION_SET_PROGRAM_STDIO_REDIRECTION, [program_id, stdin_redirection, stdin_file_name_string_id, stdout_redirection, stdout_file_name_string_id, stderr_redirection, stderr_file_name_string_id], 'S C S C S C S', 1, 'C'
|
777
772
|
end
|
778
773
|
|
779
774
|
# FIXME: stdio file names are relative to <home>/programs/<identifier>/bin
|
780
775
|
def get_program_stdio_redirection(program_id, session_id)
|
781
|
-
send_request
|
776
|
+
send_request FUNCTION_GET_PROGRAM_STDIO_REDIRECTION, [program_id, session_id], 'S S', 10, 'C C S C S C S'
|
782
777
|
end
|
783
778
|
|
784
779
|
#
|
785
780
|
def set_program_schedule(program_id, start_mode, continue_after_error, start_interval, start_fields_string_id)
|
786
|
-
send_request
|
781
|
+
send_request FUNCTION_SET_PROGRAM_SCHEDULE, [program_id, start_mode, continue_after_error, start_interval, start_fields_string_id], 'S C ? L S', 1, 'C'
|
787
782
|
end
|
788
783
|
|
789
784
|
#
|
790
785
|
def get_program_schedule(program_id, session_id)
|
791
|
-
send_request
|
786
|
+
send_request FUNCTION_GET_PROGRAM_SCHEDULE, [program_id, session_id], 'S S', 9, 'C C ? L S'
|
792
787
|
end
|
793
788
|
|
794
789
|
# FIXME: message is currently valid in error-occurred state only
|
795
790
|
def get_program_scheduler_state(program_id, session_id)
|
796
|
-
send_request
|
791
|
+
send_request FUNCTION_GET_PROGRAM_SCHEDULER_STATE, [program_id, session_id], 'S S', 12, 'C C Q S'
|
797
792
|
end
|
798
793
|
|
799
794
|
#
|
800
795
|
def continue_program_schedule(program_id)
|
801
|
-
send_request
|
796
|
+
send_request FUNCTION_CONTINUE_PROGRAM_SCHEDULE, [program_id], 'S', 1, 'C'
|
802
797
|
end
|
803
798
|
|
804
799
|
#
|
805
800
|
def start_program(program_id)
|
806
|
-
send_request
|
801
|
+
send_request FUNCTION_START_PROGRAM, [program_id], 'S', 1, 'C'
|
807
802
|
end
|
808
803
|
|
809
804
|
#
|
810
805
|
def get_last_spawned_program_process(program_id, session_id)
|
811
|
-
send_request
|
806
|
+
send_request FUNCTION_GET_LAST_SPAWNED_PROGRAM_PROCESS, [program_id, session_id], 'S S', 11, 'C S Q'
|
812
807
|
end
|
813
808
|
|
814
809
|
#
|
815
810
|
def get_custom_program_option_names(program_id, session_id)
|
816
|
-
send_request
|
811
|
+
send_request FUNCTION_GET_CUSTOM_PROGRAM_OPTION_NAMES, [program_id, session_id], 'S S', 3, 'C S'
|
817
812
|
end
|
818
813
|
|
819
814
|
#
|
820
815
|
def set_custom_program_option_value(program_id, name_string_id, value_string_id)
|
821
|
-
send_request
|
816
|
+
send_request FUNCTION_SET_CUSTOM_PROGRAM_OPTION_VALUE, [program_id, name_string_id, value_string_id], 'S S S', 1, 'C'
|
822
817
|
end
|
823
818
|
|
824
819
|
#
|
825
820
|
def get_custom_program_option_value(program_id, name_string_id, session_id)
|
826
|
-
send_request
|
821
|
+
send_request FUNCTION_GET_CUSTOM_PROGRAM_OPTION_VALUE, [program_id, name_string_id, session_id], 'S S S', 3, 'C S'
|
827
822
|
end
|
828
823
|
|
829
824
|
#
|
830
825
|
def remove_custom_program_option(program_id, name_string_id)
|
831
|
-
send_request
|
826
|
+
send_request FUNCTION_REMOVE_CUSTOM_PROGRAM_OPTION, [program_id, name_string_id], 'S S', 1, 'C'
|
832
827
|
end
|
833
828
|
|
834
829
|
# Returns the UID, the UID where the Brick is connected to,
|
@@ -840,7 +835,7 @@ module Tinkerforge
|
|
840
835
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
841
836
|
# |device_identifier_constant|
|
842
837
|
def get_identity
|
843
|
-
send_request
|
838
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
844
839
|
end
|
845
840
|
|
846
841
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|