Class: AastraXmlApi::PhoneImageScreen
- Defined in:
- lib/aastra_xml_api/phone_image_screen.rb
Constant Summary
Constants inherited from Phone
AastraXmlApi::Phone::HIGHASCII
Instance Method Summary collapse
-
#render ⇒ Object
Creates XML text output.
-
#setAlignment(vertical = nil, horizontal = nil) ⇒ Object
Set the alignment of the image.
-
#setAllowDTMF ⇒ Object
When set, allows the user’s pressed keys to be sent as DTMF through the phone when the phone is in an active call.
-
#setGDImage(gdImage) ⇒ Object
Sets the image using an externally generated GD image.
-
#setImage(image) ⇒ Object
Set the image as a string of hex characters.
-
#setSize(height, width) ⇒ Object
Sets the size of the image.
Methods inherited from Phone
#addIcon, #addSoftkey, #convert_high_ascii, #escape, #getRefreshTimeout, #getRefreshURL, #initialize, #setAllowAnswer, #setBeep, #setCancelAction, #setDestroyOnExit, #setLockIn, #setRefresh, #setTimeout, #setTitle, #setTitleWrap
Constructor Details
This class inherits a constructor from AastraXmlApi::Phone
Instance Method Details
#render ⇒ Object
Creates XML text output.
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 |
# File 'lib/aastra_xml_api/phone_image_screen.rb', line 112 def render out = "<PhoneImageScreen" out += " destroyOnExit=\"yes\"" if @destroyOnExit == "yes" out += " cancelAction=\"#{escape(@cancelAction)}\"" if not @cancelAction.nil? out += " Beep=\"yes\"" if @beep == "yes" out += " LockIn=\"yes\"" if @locking == "yes" out += " Timeout=\"#{@timeout}\"" if @timeout != 0 out += " allowDTMF=\"yes\"" if @allowDTMF == "yes" out += ">\n" out += "<Image" out += " verticalAlign=\"#{@verticalAlign}\"" if not @verticalAlign.nil? out += " horizontalAlign=\"#{@horizontalAlign}\"" if not @horizontalAlign.nil? out += " height=\"#{@height}\"" if not @height.nil? out += " width=\"#{@width}\"" if not @width.nil? out += ">#{@image}</Image>\n" @softkeys.each { |softkey| out += softkey.render } iconList = 0 @icons.each do |icon| if iconList == 0 then out += "<IconList>\n" iconList = 1 end out += icon.render end out += "</IconList>\n" if iconList != 0 out += "</PhoneImageScreen>\n" return out end |
#setAlignment(vertical = nil, horizontal = nil) ⇒ Object
Set the alignment of the image. vertical is one of ‘top’, ‘middle’ (default), or ‘bottom’. horizontal is one of ‘left’, ‘middle’ (default), or ‘right’.
71 72 73 74 |
# File 'lib/aastra_xml_api/phone_image_screen.rb', line 71 def setAlignment(vertical=nil, horizontal=nil) @verticalAlign = vertical @horizontalAlign = horizontal end |
#setAllowDTMF ⇒ Object
When set, allows the user’s pressed keys to be sent as DTMF through the phone when the phone is in an active call.
107 108 109 |
# File 'lib/aastra_xml_api/phone_image_screen.rb', line 107 def setAllowDTMF @allowDTMF = "yes" end |
#setGDImage(gdImage) ⇒ Object
Sets the image using an externally generated GD image. This should be done with an PhoneGDImage.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/aastra_xml_api/phone_image_screen.rb', line 84 def setGDImage(gdImage) img = gdImage.getGDImage byte = 0 i = 0 imageHexString = "" for x in 0..143 for y in 0..39 rgb = img.getPixel(x, y) byte += 2**(7-(i%8)) if rgb > 0 if (i%8) == 7 then byteHex ="%02x" % byte imageHexString += byteHex byte = 0 end i += 1 end end setImage(imageHexString) setSize(40,144) end |
#setImage(image) ⇒ Object
Set the image as a string of hex characters.
64 65 66 |
# File 'lib/aastra_xml_api/phone_image_screen.rb', line 64 def setImage(image) @image = image end |
#setSize(height, width) ⇒ Object
Sets the size of the image. Must match the actual image size.
77 78 79 80 |
# File 'lib/aastra_xml_api/phone_image_screen.rb', line 77 def setSize(height, width) @height = height @width = width end |