Class: Transmitter
- Inherits:
-
Object
- Object
- Transmitter
- Defined in:
- lib/hypertube-ruby-sdk/core/transmitter/transmitter.rb
Class Method Summary collapse
- .activate(license_key) ⇒ Object
- .get_native_error ⇒ Object
- .send_command(message_byte_array, message_byte_array_len) ⇒ Object
- .set_config_source(config_path) ⇒ Object
- .set_working_directory(config_path) ⇒ Object
Class Method Details
.activate(license_key) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/hypertube-ruby-sdk/core/transmitter/transmitter.rb', line 27 def self.activate(license_key) activation_result = TransmitterWrapper.Activate(license_key) if activation_result < 0 = get_native_error raise Exception.new "RuntimeBridge activation result: " + activation_result.to_s + ". Native error message: " + else return activation_result end end |
.get_native_error ⇒ Object
37 38 39 |
# File 'lib/hypertube-ruby-sdk/core/transmitter/transmitter.rb', line 37 def self.get_native_error TransmitterWrapper.GetNativeError end |
.send_command(message_byte_array, message_byte_array_len) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/hypertube-ruby-sdk/core/transmitter/transmitter.rb', line 7 def self.send_command(, ) = FFI::MemoryPointer.new(:uchar, , true) .put_array_of_uchar(0, ) response_len = TransmitterWrapper.SendCommand(, ) if response_len.positive? response = FFI::MemoryPointer.new(:uchar, response_len, true) response.put_uchar(0, .get_uchar(0)) TransmitterWrapper.ReadResponse(response, response_len) response.get_array_of_uchar(0, response_len) elsif response_len.zero? raise RuntimeError, "Response is empty" else = get_native_error raise RuntimeError, "RuntimeBridge native error code: #{response_len}. #{}" end end |
.set_config_source(config_path) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/hypertube-ruby-sdk/core/transmitter/transmitter.rb', line 41 def self.set_config_source(config_path) set_config_result = TransmitterWrapper.SetConfigSource(config_path) if set_config_result < 0 = get_native_error raise Exception.new "RuntimeBridge set config source result: " + set_config_result.to_s + ". Native error message: " + else return set_config_result end end |
.set_working_directory(config_path) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/hypertube-ruby-sdk/core/transmitter/transmitter.rb', line 51 def self.set_working_directory(config_path) set_working_directory_result = TransmitterWrapper.SetWorkingDirectory(config_path) if set_working_directory_result < 0 = get_native_error raise Exception.new "RuntimeBridge set working directory result: " + set_working_directory_result.to_s + ". Native error message: " + else return set_working_directory_result end end |