Class: OpenC3::RouterMicroservice
- Inherits:
-
InterfaceMicroservice
- Object
- Microservice
- InterfaceMicroservice
- OpenC3::RouterMicroservice
- Defined in:
- lib/openc3/microservices/router_microservice.rb
Constant Summary
Constants inherited from InterfaceMicroservice
InterfaceMicroservice::UNKNOWN_BYTES_TO_PRINT
Instance Attribute Summary
Attributes inherited from Microservice
#count, #custom, #error, #logger, #microservice_status_thread, #name, #scope, #secrets, #state
Instance Method Summary collapse
Methods inherited from InterfaceMicroservice
#attempting, #connect, #disconnect, #graceful_kill, #handle_connection_failed, #handle_connection_lost, #initialize, #run, #shutdown, #stop
Methods inherited from Microservice
#as_json, #initialize, run, #run, #shutdown
Constructor Details
This class inherits a constructor from OpenC3::InterfaceMicroservice
Instance Method Details
#handle_packet(packet) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/openc3/microservices/router_microservice.rb', line 27 def handle_packet(packet) @count += 1 RouterStatusModel.set(@interface.as_json(:allow_nan => true), scope: @scope) if !packet.identified? # Need to identify so we can find the target identified_packet = System.commands.identify(packet.buffer(false), @cmd_target_names) packet = identified_packet if identified_packet end begin RouterTopic.route_command(packet, @cmd_target_names, scope: @scope) @count += 1 rescue Exception => err @error = err @logger.error "Error routing command from #{@interface.name}\n#{err.formatted}" end end |