Sha256: 3d1df224f108d4c7185a69951e3a81aa4ff66fcc0dcae4625895f6c5a5467f99

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

module Orchestrator
    module Device
        module Mixin
            include ::Orchestrator::Core::Mixin

            def send(data, options = {}, &blk)
                options[:data] = data
                options[:defer] = @__config__.thread.defer
                options[:on_receive] = blk if blk     # on command success
                @__config__.thread.schedule do
                    @__config__.processor.queue_command(options)
                end
                options[:defer].promise
            end

            def disconnect
                @__config__.thread.schedule do
                    @__config__.connection.disconnect
                end
            end

            def config(options)
                @__config__.thread.schedule do
                    @__config__.processor.config = options
                end
            end

            def defaults(options)
                @__config__.thread.schedule do
                    @__config__.processor.send_options(options)
                end
            end
        end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
orchestrator-1.0.3 lib/orchestrator/device/mixin.rb
orchestrator-1.0.2 lib/orchestrator/device/mixin.rb
orchestrator-1.0.1 lib/orchestrator/device/mixin.rb