Class: KRPC::Services::Core
- Inherits:
-
ServiceBase
- Object
- ServiceBase
- KRPC::Services::Core
- Includes:
- Gen::RPCMethodGenerator
- Defined in:
- lib/krpc/service.rb
Overview
Hardcoded version of ‘krpc` service - The core kRPC service, e.g. for querying for the available services.
Constant Summary
Constants included from KRPC::Streaming::StreamConstructors
KRPC::Streaming::StreamConstructors::STREAM_METHOD_REGEX, KRPC::Streaming::StreamConstructors::STREAM_METHOD_SUFFIX
Constants included from Doc::SuffixMethods
Doc::SuffixMethods::DOCSTRING_SUFFIX, Doc::SuffixMethods::DOCSTRING_SUFFIX_REGEX
Instance Attribute Summary
Attributes inherited from ServiceBase
Instance Method Summary collapse
-
#initialize(client) ⇒ Core
constructor
A new instance of Core.
Methods included from Gen::RPCMethodGenerator
Methods included from KRPC::Streaming::StreamConstructors
included, #method_missing, #respond_to_missing?
Methods included from Doc::SuffixMethods
included, #method_missing, #respond_to_missing?
Constructor Details
#initialize(client) ⇒ Core
Returns a new instance of Core.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/krpc/service.rb', line 84 def initialize(client) super(client) unless respond_to? :get_status # Generate enumerations TypeStore['Enum(Core.GameScene)'].set_values( Encoder.hash_to_enumeration_values( space_center: 0, flight: 1, tracking_station: 2, editor_vab: 3, editor_sph: 4 ) ) # Generate procedures opts = {doc_service_name: 'Core'} include_rpc_method 'get_status', 'KRPC', 'GetStatus', return_type: 'KRPC.Status', xmldoc: "<doc><summary>Gets a status message from the server containing information including the server’s version string and performance statistics.</summary></doc>", switches: [:static], options: opts include_rpc_method 'get_services', 'KRPC', 'GetServices', return_type: 'KRPC.Services', xmldoc: "<doc><summary>Gets available services and procedures.</summary></doc>", switches: [:static, :no_stream], options: opts include_rpc_method 'add_stream', 'KRPC', 'AddStream', params: [PB::Parameter.new(name: 'request', type: 'KRPC.Request')], return_type: 'uint32', xmldoc: "<doc><summary>Add a streaming request. Returns it's identifier.</summary></doc>", switches: [:static, :no_stream], options: opts include_rpc_method 'remove_stream', 'KRPC', 'RemoveStream', params: [PB::Parameter.new(name: 'id', type: 'uint32')], xmldoc: "<doc><summary>Remove a streaming request</summary></doc>", switches: [:static, :no_stream], options: opts include_rpc_method 'clients', 'KRPC', 'get_Clients', return_type: 'KRPC.List', attributes: ['Property.Get(Clients)', 'ReturnType.List(Tuple(bytes,string,string))'], xmldoc: "<doc><summary>A list of RPC clients that are currently connected to the server.\nEach entry in the list is a clients identifier, name and address.</summary></doc>", switches: [:static], options: opts include_rpc_method 'current_game_scene', 'KRPC', 'get_CurrentGameScene', return_type: 'int32', attributes: ['Property.Get(CurrentGameScene)', 'ReturnType.Enum(Core.GameScene)'], xmldoc: "<doc><summary>Get the current game scene.</summary></doc>", switches: [:static], options: opts end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class KRPC::Streaming::StreamConstructors