aca-device-modules 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/aca-device-modules/version.rb +1 -1
 - data/modules/aca/lifter_logic_auto.rb +71 -0
 - data/modules/aca/lifter_logic_manual.rb +105 -0
 - data/modules/aca/pc_control.rb +111 -111
 - data/modules/axis/camera/vapix.rb +10 -3
 - data/modules/biamp/nexia.rb +149 -128
 - data/modules/bss/blu100.rb +8 -8
 - data/modules/chiyu/cyt.rb +6 -1
 - data/modules/clipsal/c_bus.rb +233 -235
 - data/modules/epson/projector/esc_vp21.rb +232 -232
 - data/modules/extron/mixer/dmp44.rb +174 -174
 - data/modules/extron/mixer/dmp64.rb +192 -181
 - data/modules/extron/switcher/dxp.rb +210 -210
 - data/modules/global_cache/gc100.rb +6 -2
 - data/modules/kramer/switcher/protocol3000.rb +209 -209
 - data/modules/kramer/switcher/vs_hdmi.rb +111 -110
 - data/modules/nec/display/all.rb +440 -443
 - data/modules/nec/projector/np_series.rb +609 -597
 - data/modules/panasonic/camera/he50.rb +1 -1
 - data/modules/panasonic/projector/tcp.rb +239 -234
 - data/modules/philips/dynalite.rb +196 -0
 - data/modules/samsung/displays/md_series.rb +34 -16
 - data/modules/screen_technics/connect.rb +53 -53
 - data/modules/sony/display/id_talk.rb +275 -275
 - data/modules/sony/projector/pj_talk.rb +257 -257
 - data/modules/vaddio/camera/clear_view_ptz_telnet.rb +7 -3
 - metadata +6 -3
 
| 
         @@ -6,11 +6,11 @@ module Sony::Projector; end 
     | 
|
| 
       6 
6 
     | 
    
         
             
            # Port: 53484
         
     | 
| 
       7 
7 
     | 
    
         
             
            #
         
     | 
| 
       8 
8 
     | 
    
         
             
            class Sony::Projector::PjTalk
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
                include ::Orchestrator::Constants
         
     | 
| 
       10 
10 
     | 
    
         
             
                include ::Orchestrator::Transcoder
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
                def on_load
         
     | 
| 
      
 13 
     | 
    
         
            +
                    self[:brightness_min] = 0x00
         
     | 
| 
       14 
14 
     | 
    
         
             
                    self[:brightness_max] = 0x64
         
     | 
| 
       15 
15 
     | 
    
         
             
                    self[:contrast_min] = 0x00
         
     | 
| 
       16 
16 
     | 
    
         
             
                    self[:contrast_max] = 0x64
         
     | 
| 
         @@ -18,8 +18,8 @@ class Sony::Projector::PjTalk 
     | 
|
| 
       18 
18 
     | 
    
         
             
                    self[:power] = false
         
     | 
| 
       19 
19 
     | 
    
         
             
                    self[:type] = :projector
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
                    on_update
         
     | 
| 
      
 22 
     | 
    
         
            +
                    config({
         
     | 
| 
       23 
23 
     | 
    
         
             
                        tokenize: proc {
         
     | 
| 
       24 
24 
     | 
    
         
             
                            ::UV::AbstractTokenizer.new({
         
     | 
| 
       25 
25 
     | 
    
         
             
                                indicator: "\x02\x0a",  # Header
         
     | 
| 
         @@ -28,273 +28,273 @@ class Sony::Projector::PjTalk 
     | 
|
| 
       28 
28 
     | 
    
         
             
                        }
         
     | 
| 
       29 
29 
     | 
    
         
             
                    })
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 31 
     | 
    
         
            +
                    defaults({
         
     | 
| 
      
 32 
     | 
    
         
            +
                        delay_on_receive: 200
         
     | 
| 
      
 33 
     | 
    
         
            +
                    })
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
      
 36 
     | 
    
         
            +
                def on_update
         
     | 
| 
      
 37 
     | 
    
         
            +
                    # Default community value is SONY - can be changed in displays settings
         
     | 
| 
      
 38 
     | 
    
         
            +
                    @community = str_to_array(setting(:community) || 'SONY')
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
                
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
      
 42 
     | 
    
         
            +
                def connected
         
     | 
| 
      
 43 
     | 
    
         
            +
                    @polling_timer = schedule.every('60s', method(:do_poll))
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 46 
     | 
    
         
            +
                def disconnected
         
     | 
| 
      
 47 
     | 
    
         
            +
                    @polling_timer.cancel unless @polling_timer.nil?
         
     | 
| 
       48 
48 
     | 
    
         
             
                    @polling_timer = nil
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       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 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
             
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
             
     | 
| 
       160 
     | 
    
         
            -
             
     | 
| 
       161 
     | 
    
         
            -
             
     | 
| 
       162 
     | 
    
         
            -
             
     | 
| 
       163 
     | 
    
         
            -
             
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
       167 
     | 
    
         
            -
             
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
             
     | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
             
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
             
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
       188 
     | 
    
         
            -
             
     | 
| 
       189 
     | 
    
         
            -
             
     | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
             
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
             
     | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
       198 
     | 
    
         
            -
             
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
       203 
     | 
    
         
            -
             
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
       213 
     | 
    
         
            -
             
     | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
       215 
     | 
    
         
            -
             
     | 
| 
       216 
     | 
    
         
            -
             
     | 
| 
       217 
     | 
    
         
            -
             
     | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
                
         
     | 
| 
      
 51 
     | 
    
         
            +
                
         
     | 
| 
      
 52 
     | 
    
         
            +
                #
         
     | 
| 
      
 53 
     | 
    
         
            +
                # Power commands
         
     | 
| 
      
 54 
     | 
    
         
            +
                #
         
     | 
| 
      
 55 
     | 
    
         
            +
                def power(state)
         
     | 
| 
      
 56 
     | 
    
         
            +
                    if is_affirmative?(state)
         
     | 
| 
      
 57 
     | 
    
         
            +
                        do_send(:set, :power_on, name: :power, delay_on_receive: 3000)
         
     | 
| 
      
 58 
     | 
    
         
            +
                        logger.debug "-- sony display requested to power on"
         
     | 
| 
      
 59 
     | 
    
         
            +
                    else
         
     | 
| 
      
 60 
     | 
    
         
            +
                        do_send(:set, :power_off, name: :power, delay_on_receive: 3000)
         
     | 
| 
      
 61 
     | 
    
         
            +
                        logger.debug "-- sony display requested to power off"
         
     | 
| 
      
 62 
     | 
    
         
            +
                    end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                    # Request status update
         
     | 
| 
      
 65 
     | 
    
         
            +
                    power?
         
     | 
| 
      
 66 
     | 
    
         
            +
                end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                def power?(options = {}, &block)
         
     | 
| 
      
 69 
     | 
    
         
            +
                    options[:emit] = block if block_given?
         
     | 
| 
      
 70 
     | 
    
         
            +
                    options[:priority] = 0
         
     | 
| 
      
 71 
     | 
    
         
            +
                    do_send(:get, :power_status, options)
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
                
         
     | 
| 
      
 74 
     | 
    
         
            +
                
         
     | 
| 
      
 75 
     | 
    
         
            +
                
         
     | 
| 
      
 76 
     | 
    
         
            +
                #
         
     | 
| 
      
 77 
     | 
    
         
            +
                # Input selection
         
     | 
| 
      
 78 
     | 
    
         
            +
                #
         
     | 
| 
      
 79 
     | 
    
         
            +
                INPUTS = {
         
     | 
| 
      
 80 
     | 
    
         
            +
                    :vga => [0x00, 0x03],
         
     | 
| 
      
 81 
     | 
    
         
            +
                    :dvi => [0x00, 0x04],
         
     | 
| 
      
 82 
     | 
    
         
            +
                    :hdmi => [0x00, 0x05]
         
     | 
| 
      
 83 
     | 
    
         
            +
                }
         
     | 
| 
      
 84 
     | 
    
         
            +
                INPUTS.merge!(INPUTS.invert)
         
     | 
| 
      
 85 
     | 
    
         
            +
                
         
     | 
| 
      
 86 
     | 
    
         
            +
                
         
     | 
| 
      
 87 
     | 
    
         
            +
                def switch_to(input)
         
     | 
| 
      
 88 
     | 
    
         
            +
                    input = input.to_sym
         
     | 
| 
      
 89 
     | 
    
         
            +
                    return unless INPUTS.has_key? input
         
     | 
| 
      
 90 
     | 
    
         
            +
                    
         
     | 
| 
      
 91 
     | 
    
         
            +
                    do_send(:set, :input, INPUTS[input], delay_on_receive: 500)
         
     | 
| 
      
 92 
     | 
    
         
            +
                    logger.debug "-- sony projector, requested to switch to: #{input}"
         
     | 
| 
      
 93 
     | 
    
         
            +
                    
         
     | 
| 
      
 94 
     | 
    
         
            +
                    input?
         
     | 
| 
      
 95 
     | 
    
         
            +
                end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                def input?
         
     | 
| 
      
 98 
     | 
    
         
            +
                    do_send(:get, :input, {:priority => 0})
         
     | 
| 
      
 99 
     | 
    
         
            +
                end
         
     | 
| 
      
 100 
     | 
    
         
            +
                
         
     | 
| 
      
 101 
     | 
    
         
            +
                
         
     | 
| 
      
 102 
     | 
    
         
            +
                #
         
     | 
| 
      
 103 
     | 
    
         
            +
                # Mute Audio and Video
         
     | 
| 
      
 104 
     | 
    
         
            +
                #
         
     | 
| 
      
 105 
     | 
    
         
            +
                def mute(val = true)
         
     | 
| 
      
 106 
     | 
    
         
            +
                    logger.debug "-- sony projector, requested to mute"
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
                    actual = is_affirmative?(val) ? [0x00, 0x01] : [0x00, 0x00]
         
     | 
| 
      
 109 
     | 
    
         
            +
                    do_send(:set, :mute, actual, delay_on_receive: 500)
         
     | 
| 
      
 110 
     | 
    
         
            +
                end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                def unmute
         
     | 
| 
      
 113 
     | 
    
         
            +
                    logger.debug "-- sony projector, requested to unmute"
         
     | 
| 
      
 114 
     | 
    
         
            +
                    mute(false)
         
     | 
| 
      
 115 
     | 
    
         
            +
                end
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                def mute?
         
     | 
| 
      
 118 
     | 
    
         
            +
                    do_send(:get, :mute, {:priority => 0})
         
     | 
| 
      
 119 
     | 
    
         
            +
                end
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
                #
         
     | 
| 
      
 123 
     | 
    
         
            +
                # Automatically creates a callable function for each command
         
     | 
| 
      
 124 
     | 
    
         
            +
                #    http://blog.jayfields.com/2007/10/ruby-defining-class-methods.html
         
     | 
| 
      
 125 
     | 
    
         
            +
                #    http://blog.jayfields.com/2008/02/ruby-dynamically-define-method.html
         
     | 
| 
      
 126 
     | 
    
         
            +
                #
         
     | 
| 
      
 127 
     | 
    
         
            +
                [:contrast, :brightness, :color, :hue, :sharpness].each do |command|
         
     | 
| 
      
 128 
     | 
    
         
            +
                    # Query command
         
     | 
| 
      
 129 
     | 
    
         
            +
                    define_method :"#{command}?" do
         
     | 
| 
      
 130 
     | 
    
         
            +
                        do_send(:get, command, {:priority => 0})
         
     | 
| 
      
 131 
     | 
    
         
            +
                    end
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
                    # Set value command
         
     | 
| 
      
 134 
     | 
    
         
            +
                    define_method command do |level|
         
     | 
| 
      
 135 
     | 
    
         
            +
                        level = in_range(level, 0x64)
         
     | 
| 
      
 136 
     | 
    
         
            +
                        do_send(:set, command, [0x00, level])
         
     | 
| 
      
 137 
     | 
    
         
            +
                        __send__(:"#{command}?")
         
     | 
| 
      
 138 
     | 
    
         
            +
                    end
         
     | 
| 
      
 139 
     | 
    
         
            +
                end
         
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
      
 141 
     | 
    
         
            +
                
         
     | 
| 
      
 142 
     | 
    
         
            +
                ERRORS = {
         
     | 
| 
      
 143 
     | 
    
         
            +
                    0x00 => 'No Error'.freeze,
         
     | 
| 
      
 144 
     | 
    
         
            +
                    0x01 => 'Lamp Error'.freeze,
         
     | 
| 
      
 145 
     | 
    
         
            +
                    0x02 => 'Fan Error'.freeze,
         
     | 
| 
      
 146 
     | 
    
         
            +
                    0x04 => 'Cover Error'.freeze,
         
     | 
| 
      
 147 
     | 
    
         
            +
                    0x08 => 'Temperature Error'.freeze,
         
     | 
| 
      
 148 
     | 
    
         
            +
                    0x10 => 'D5V Error'.freeze,
         
     | 
| 
      
 149 
     | 
    
         
            +
                    0x20 => 'Power Error'.freeze,
         
     | 
| 
      
 150 
     | 
    
         
            +
                    0x40 => 'Warning Error'.freeze
         
     | 
| 
      
 151 
     | 
    
         
            +
                }
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                def received(byte_str, resolve, command)        # Data is default received as a string
         
     | 
| 
      
 155 
     | 
    
         
            +
                    # Remove community string (useless)
         
     | 
| 
      
 156 
     | 
    
         
            +
                    logger.debug  "sony proj sent: 0x#{byte_to_hex(byte_str[4..-1])}"
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
                    data = str_to_array(byte_str)
         
     | 
| 
      
 159 
     | 
    
         
            +
                    pjt_command = data[5..6]
         
     | 
| 
      
 160 
     | 
    
         
            +
                    pjt_length = data[7]
         
     | 
| 
      
 161 
     | 
    
         
            +
                    pjt_data = data[8..-1]
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
                    if data[4] == 0x01
         
     | 
| 
      
 164 
     | 
    
         
            +
                        case COMMANDS[pjt_command]
         
     | 
| 
      
 165 
     | 
    
         
            +
                        when :power_on
         
     | 
| 
      
 166 
     | 
    
         
            +
                            self[:power] = On
         
     | 
| 
      
 167 
     | 
    
         
            +
                        when :power_off
         
     | 
| 
      
 168 
     | 
    
         
            +
                            self[:power] = Off
         
     | 
| 
      
 169 
     | 
    
         
            +
                        else
         
     | 
| 
      
 170 
     | 
    
         
            +
                            # Same switch however now we know there is data
         
     | 
| 
      
 171 
     | 
    
         
            +
                            if pjt_length > 0
         
     | 
| 
      
 172 
     | 
    
         
            +
                                case COMMANDS[pjt_command]
         
     | 
| 
      
 173 
     | 
    
         
            +
                                when :power_status
         
     | 
| 
      
 174 
     | 
    
         
            +
                                    case pjt_data[-1]
         
     | 
| 
      
 175 
     | 
    
         
            +
                                    when 0, 8
         
     | 
| 
      
 176 
     | 
    
         
            +
                                        self[:warming] = self[:cooling] = self[:power] = false
         
     | 
| 
      
 177 
     | 
    
         
            +
                                    when 1, 2
         
     | 
| 
      
 178 
     | 
    
         
            +
                                        self[:cooling] = false
         
     | 
| 
      
 179 
     | 
    
         
            +
                                        self[:warming] = self[:power] = true
         
     | 
| 
      
 180 
     | 
    
         
            +
                                    when 3
         
     | 
| 
      
 181 
     | 
    
         
            +
                                        self[:power] = true
         
     | 
| 
      
 182 
     | 
    
         
            +
                                        self[:warming] = self[:cooling] = false
         
     | 
| 
      
 183 
     | 
    
         
            +
                                    when 4, 5, 6, 7
         
     | 
| 
      
 184 
     | 
    
         
            +
                                        self[:cooling] = true
         
     | 
| 
      
 185 
     | 
    
         
            +
                                        self[:warming] = self[:power] = false
         
     | 
| 
      
 186 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 187 
     | 
    
         
            +
             
     | 
| 
      
 188 
     | 
    
         
            +
                                    if self[:warming] || self[:cooling]
         
     | 
| 
      
 189 
     | 
    
         
            +
                                        schedule.in '10s' do
         
     | 
| 
      
 190 
     | 
    
         
            +
                                            power?
         
     | 
| 
      
 191 
     | 
    
         
            +
                                        end
         
     | 
| 
      
 192 
     | 
    
         
            +
                                    end
         
     | 
| 
      
 193 
     | 
    
         
            +
                                when :mute
         
     | 
| 
      
 194 
     | 
    
         
            +
                                    self[:mute] = pjt_data[-1] == 1
         
     | 
| 
      
 195 
     | 
    
         
            +
                                when :input
         
     | 
| 
      
 196 
     | 
    
         
            +
                                    self[:input] = INPUTS[pjt_data]
         
     | 
| 
      
 197 
     | 
    
         
            +
                                when :contrast, :brightness, :color, :hue, :sharpness
         
     | 
| 
      
 198 
     | 
    
         
            +
                                    self[COMMANDS[pjt_command]] = pjt_data[-1]
         
     | 
| 
      
 199 
     | 
    
         
            +
                                when :error_status
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
                                end
         
     | 
| 
      
 202 
     | 
    
         
            +
                            end
         
     | 
| 
      
 203 
     | 
    
         
            +
                        end
         
     | 
| 
      
 204 
     | 
    
         
            +
                    else
         
     | 
| 
      
 205 
     | 
    
         
            +
                        # Command failed..
         
     | 
| 
      
 206 
     | 
    
         
            +
                        self[:last_error] = pjt_data
         
     | 
| 
      
 207 
     | 
    
         
            +
                        logger.debug "Command #{pjt_command} failed with Major 0x#{pjt_data[0].to_s(16)} and Minor 0x#{pjt_data[1].to_s(16)}"
         
     | 
| 
      
 208 
     | 
    
         
            +
                        return :abort
         
     | 
| 
      
 209 
     | 
    
         
            +
                    end
         
     | 
| 
      
 210 
     | 
    
         
            +
             
     | 
| 
      
 211 
     | 
    
         
            +
                    :success
         
     | 
| 
      
 212 
     | 
    
         
            +
                end
         
     | 
| 
      
 213 
     | 
    
         
            +
             
     | 
| 
      
 214 
     | 
    
         
            +
                
         
     | 
| 
      
 215 
     | 
    
         
            +
                protected
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
                # Called by the Abstract Tokenizer to confirm we have the
         
     | 
| 
      
 219 
     | 
    
         
            +
                # whole message.
         
     | 
| 
       220 
220 
     | 
    
         
             
                def check_complete(byte_str)
         
     | 
| 
       221 
     | 
    
         
            -
             
     | 
| 
      
 221 
     | 
    
         
            +
                    bytes = str_to_array(byte_str)
         
     | 
| 
       222 
222 
     | 
    
         | 
| 
       223 
     | 
    
         
            -
             
     | 
| 
      
 223 
     | 
    
         
            +
                    # Min message length is 8 bytes
         
     | 
| 
       224 
224 
     | 
    
         
             
                    return false if bytes.length < 8
         
     | 
| 
       225 
225 
     | 
    
         | 
| 
       226 
226 
     | 
    
         
             
                    # Check we have the data
         
     | 
| 
       227 
227 
     | 
    
         
             
                    data = bytes[8..-1]
         
     | 
| 
       228 
228 
     | 
    
         
             
                    if data.length == bytes[7]
         
     | 
| 
       229 
     | 
    
         
            -
             
     | 
| 
      
 229 
     | 
    
         
            +
                        return true
         
     | 
| 
       230 
230 
     | 
    
         
             
                    elsif data.length > bytes[7]
         
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
      
 231 
     | 
    
         
            +
                        # Let the tokeniser know we only want the following number of bytes
         
     | 
| 
      
 232 
     | 
    
         
            +
                        return 7 + bytes[7]
         
     | 
| 
       233 
233 
     | 
    
         
             
                    end
         
     | 
| 
       234 
234 
     | 
    
         | 
| 
       235 
235 
     | 
    
         
             
                    # Still waiting on data
         
     | 
| 
       236 
236 
     | 
    
         
             
                    return false
         
     | 
| 
       237 
237 
     | 
    
         
             
                end
         
     | 
| 
       238 
     | 
    
         
            -
             
     | 
| 
       239 
     | 
    
         
            -
             
     | 
| 
       240 
     | 
    
         
            -
             
     | 
| 
       241 
     | 
    
         
            -
             
     | 
| 
       242 
     | 
    
         
            -
             
     | 
| 
       243 
     | 
    
         
            -
             
     | 
| 
       244 
     | 
    
         
            -
             
     | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
       246 
     | 
    
         
            -
             
     | 
| 
       247 
     | 
    
         
            -
             
     | 
| 
       248 
     | 
    
         
            -
             
     | 
| 
       249 
     | 
    
         
            -
             
     | 
| 
       250 
     | 
    
         
            -
             
     | 
| 
       251 
     | 
    
         
            -
             
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
       253 
     | 
    
         
            -
             
     | 
| 
       254 
     | 
    
         
            -
             
     | 
| 
       255 
     | 
    
         
            -
             
     | 
| 
       256 
     | 
    
         
            -
             
     | 
| 
       257 
     | 
    
         
            -
             
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
       259 
     | 
    
         
            -
             
     | 
| 
       260 
     | 
    
         
            -
             
     | 
| 
       261 
     | 
    
         
            -
             
     | 
| 
       262 
     | 
    
         
            -
             
     | 
| 
       263 
     | 
    
         
            -
             
     | 
| 
       264 
     | 
    
         
            -
             
     | 
| 
       265 
     | 
    
         
            -
             
     | 
| 
       266 
     | 
    
         
            -
             
     | 
| 
       267 
     | 
    
         
            -
             
     | 
| 
       268 
     | 
    
         
            -
             
     | 
| 
       269 
     | 
    
         
            -
             
     | 
| 
       270 
     | 
    
         
            -
             
     | 
| 
       271 
     | 
    
         
            -
             
     | 
| 
       272 
     | 
    
         
            -
             
     | 
| 
       273 
     | 
    
         
            -
             
     | 
| 
       274 
     | 
    
         
            -
             
     | 
| 
       275 
     | 
    
         
            -
             
     | 
| 
       276 
     | 
    
         
            -
             
     | 
| 
       277 
     | 
    
         
            -
             
     | 
| 
       278 
     | 
    
         
            -
             
     | 
| 
       279 
     | 
    
         
            -
             
     | 
| 
       280 
     | 
    
         
            -
             
     | 
| 
       281 
     | 
    
         
            -
             
     | 
| 
       282 
     | 
    
         
            -
             
     | 
| 
       283 
     | 
    
         
            -
             
     | 
| 
       284 
     | 
    
         
            -
             
     | 
| 
       285 
     | 
    
         
            -
             
     | 
| 
       286 
     | 
    
         
            -
             
     | 
| 
       287 
     | 
    
         
            -
             
     | 
| 
       288 
     | 
    
         
            -
             
     | 
| 
       289 
     | 
    
         
            -
             
     | 
| 
       290 
     | 
    
         
            -
             
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
             
     | 
| 
       293 
     | 
    
         
            -
             
     | 
| 
       294 
     | 
    
         
            -
             
     | 
| 
       295 
     | 
    
         
            -
             
     | 
| 
       296 
     | 
    
         
            -
             
     | 
| 
       297 
     | 
    
         
            -
             
     | 
| 
       298 
     | 
    
         
            -
             
     | 
| 
       299 
     | 
    
         
            -
             
     | 
| 
      
 238 
     | 
    
         
            +
                
         
     | 
| 
      
 239 
     | 
    
         
            +
                
         
     | 
| 
      
 240 
     | 
    
         
            +
                def do_poll(*args)
         
     | 
| 
      
 241 
     | 
    
         
            +
                    power?({:priority => 0}) do
         
     | 
| 
      
 242 
     | 
    
         
            +
                        if self[:power]
         
     | 
| 
      
 243 
     | 
    
         
            +
                            input?
         
     | 
| 
      
 244 
     | 
    
         
            +
                            mute?
         
     | 
| 
      
 245 
     | 
    
         
            +
                            do_send(:get, :error_status, {:priority => 0})
         
     | 
| 
      
 246 
     | 
    
         
            +
                        end
         
     | 
| 
      
 247 
     | 
    
         
            +
                    end
         
     | 
| 
      
 248 
     | 
    
         
            +
                end
         
     | 
| 
      
 249 
     | 
    
         
            +
             
     | 
| 
      
 250 
     | 
    
         
            +
                # Constants as per manual page 13
         
     | 
| 
      
 251 
     | 
    
         
            +
                # version, category
         
     | 
| 
      
 252 
     | 
    
         
            +
                PjTalk_Header = [0x02, 0x0a]
         
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
                # request, category, command
         
     | 
| 
      
 256 
     | 
    
         
            +
                COMMANDS = {
         
     | 
| 
      
 257 
     | 
    
         
            +
                    power_on: [0x17, 0x2E],
         
     | 
| 
      
 258 
     | 
    
         
            +
                    power_off: [0x17, 0x2F],
         
     | 
| 
      
 259 
     | 
    
         
            +
                    input: [0x00, 0x01],
         
     | 
| 
      
 260 
     | 
    
         
            +
                    mute: [0x00, 0x30],
         
     | 
| 
      
 261 
     | 
    
         
            +
             
     | 
| 
      
 262 
     | 
    
         
            +
                    error_status: [0x01, 0x01],
         
     | 
| 
      
 263 
     | 
    
         
            +
                    power_status: [0x01, 0x02],
         
     | 
| 
      
 264 
     | 
    
         
            +
             
     | 
| 
      
 265 
     | 
    
         
            +
                    contrast: [0x00, 0x10],
         
     | 
| 
      
 266 
     | 
    
         
            +
                    brightness: [0x00, 0x11],
         
     | 
| 
      
 267 
     | 
    
         
            +
                    color: [0x00, 0x12],
         
     | 
| 
      
 268 
     | 
    
         
            +
                    hue: [0x00, 0x13],
         
     | 
| 
      
 269 
     | 
    
         
            +
                    sharpness: [0x00, 0x14],
         
     | 
| 
      
 270 
     | 
    
         
            +
                }
         
     | 
| 
      
 271 
     | 
    
         
            +
                COMMANDS.merge!(COMMANDS.invert)
         
     | 
| 
      
 272 
     | 
    
         
            +
             
     | 
| 
      
 273 
     | 
    
         
            +
             
     | 
| 
      
 274 
     | 
    
         
            +
                def do_send(getset, command, param = nil, options = {})
         
     | 
| 
      
 275 
     | 
    
         
            +
                    # Check for missing params
         
     | 
| 
      
 276 
     | 
    
         
            +
                    if param.is_a? Hash
         
     | 
| 
      
 277 
     | 
    
         
            +
                        options = param
         
     | 
| 
      
 278 
     | 
    
         
            +
                        param = nil
         
     | 
| 
      
 279 
     | 
    
         
            +
                    end
         
     | 
| 
      
 280 
     | 
    
         
            +
             
     | 
| 
      
 281 
     | 
    
         
            +
                    reqres = getset == :get ? [0x01] : [0x00]
         
     | 
| 
      
 282 
     | 
    
         
            +
             
     | 
| 
      
 283 
     | 
    
         
            +
                    # Control + Mode
         
     | 
| 
      
 284 
     | 
    
         
            +
                    if param.nil?
         
     | 
| 
      
 285 
     | 
    
         
            +
                        options[:name] = command if options[:name].nil?
         
     | 
| 
      
 286 
     | 
    
         
            +
                        cmd = COMMANDS[command] + [0x00]
         
     | 
| 
      
 287 
     | 
    
         
            +
                    else
         
     | 
| 
      
 288 
     | 
    
         
            +
                        options[:name] = :"#{command}_req" if options[:name].nil?
         
     | 
| 
      
 289 
     | 
    
         
            +
                        if !param.is_a?(Array)
         
     | 
| 
      
 290 
     | 
    
         
            +
                            param = [param]
         
     | 
| 
      
 291 
     | 
    
         
            +
                        end
         
     | 
| 
      
 292 
     | 
    
         
            +
                        cmd = COMMANDS[command] + [param.length] + param
         
     | 
| 
      
 293 
     | 
    
         
            +
                    end
         
     | 
| 
      
 294 
     | 
    
         
            +
             
     | 
| 
      
 295 
     | 
    
         
            +
                    # Build the IDTalk header         # set request every time?
         
     | 
| 
      
 296 
     | 
    
         
            +
                    pjt_cmd = PjTalk_Header + @community + reqres + cmd
         
     | 
| 
      
 297 
     | 
    
         
            +
             
     | 
| 
      
 298 
     | 
    
         
            +
                    send(pjt_cmd, options)
         
     | 
| 
      
 299 
     | 
    
         
            +
                end
         
     | 
| 
       300 
300 
     | 
    
         
             
            end
         
     |