Class: AastraXmlApi::Phone
- Inherits:
-
Object
- Object
- AastraXmlApi::Phone
- Defined in:
- lib/aastra_xml_api/phone.rb
Direct Known Subclasses
PhoneConfiguration, PhoneConfigurationEntry, PhoneDirectory, PhoneDirectoryEntry, PhoneExecute, PhoneExecuteEntry, PhoneFormattedTextScreen, PhoneFormattedTextScreenEntry, PhoneImageMenu, PhoneImageMenuEntry, PhoneImageScreen, PhoneInputScreen, PhoneStatus, PhoneStatusEntry, PhoneTextMenu, PhoneTextMenuEntry, PhoneTextScreen
Constant Summary collapse
- HIGHASCII =
{ "!\xc0!" => 'A', # A` "!\xe0!" => 'a', # a` "!\xc1!" => 'A', # A' "!\xe1!" => 'a', # a' "!\xc2!" => 'A', # A^ "!\xe2!" => 'a', # a^ "!\xc4!" => 'Ae', # A: "!\xe4!" => 'ae', # a: "!\xc3!" => 'A', # A~ "!\xe3!" => 'a', # a~ "!\xc8!" => 'E', # E` "!\xe8!" => 'e', # e` "!\xc9!" => 'E', # E' "!\xe9!" => 'e', # e' "!\xca!" => 'E', # E^ "!\xea!" => 'e', # e^ "!\xcb!" => 'Ee', # E: "!\xeb!" => 'ee', # e: "!\xcc!" => 'I', # I` "!\xec!" => 'i', # i` "!\xcd!" => 'I', # I' "!\xed!" => 'i', # i' "!\xce!" => 'I', # I^ "!\xee!" => 'i', # i^ "!\xcf!" => 'Ie', # I: "!\xef!" => 'ie', # i: "!\xd2!" => 'O', # O` "!\xf2!" => 'o', # o` "!\xd3!" => 'O', # O' "!\xf3!" => 'o', # o' "!\xd4!" => 'O', # O^ "!\xf4!" => 'o', # o^ "!\xd6!" => 'Oe', # O: "!\xf6!" => 'oe', # o: "!\xd5!" => 'O', # O~ "!\xf5!" => 'o', # o~ "!\xd8!" => 'Oe', # O/ "!\xf8!" => 'oe', # o/ "!\xd9!" => 'U', # U` "!\xf9!" => 'u', # u` "!\xda!" => 'U', # U' "!\xfa!" => 'u', # u' "!\xdb!" => 'U', # U^ "!\xfb!" => 'u', # u^ "!\xdc!" => 'Ue', # U: "!\xfc!" => 'ue', # u: "!\xc7!" => 'C', # ,C "!\xe7!" => 'c', # ,c "!\xd1!" => 'N', # N~ "!\xf1!" => 'n', # n~ "!\xdf!" => 'ss' }
Instance Method Summary collapse
-
#addIcon(index, icon) ⇒ Object
Add an icon to be used by either a softkey of PhoneTextMenu.
-
#addSoftkey(index, label, uri, icon = nil) ⇒ Object
Add a softkey to be displayed while the XML object is on the screen.
-
#convert_high_ascii(s) ⇒ Object
Convert characters when using double sized text in PhoneFormattedTextScreen.
-
#escape(s) ⇒ Object
Convert any HTML characters to the proper escaped format.
-
#getRefreshTimeout ⇒ Object
Returns the set refresh timeout value.
-
#getRefreshURL ⇒ Object
Returns the set refresh URI.
-
#initialize ⇒ Phone
constructor
Create an Phone object and set initial values.
-
#setAllowAnswer ⇒ Object
Applies only to the non-softkey phones (53i).
-
#setBeep ⇒ Object
Beep phone when XML is received.
-
#setCancelAction(cancelAction) ⇒ Object
Defines the URI to call when the user cancels the XML object.
-
#setDestroyOnExit ⇒ Object
Do not keep the object in the phone browser after exit.
-
#setLockIn ⇒ Object
Ignores all keys that would cause the screen to exit without using keys defined by the object.
-
#setRefresh(timeout, url) ⇒ Object
Set refresh timeout (seconds) and the URI to load when the timeout is reached.
-
#setTimeout(timeout) ⇒ Object
Override the default 45 second timeout.
-
#setTitle(title) ⇒ Object
Set the title of the Phone object.
-
#setTitleWrap ⇒ Object
Allow the title to wrap over multiple lines when displayed.
Constructor Details
#initialize ⇒ Phone
Create an Phone object and set initial values. Everything sent to the phone will inherit from this class.
96 97 98 99 100 101 102 |
# File 'lib/aastra_xml_api/phone.rb', line 96 def initialize @entries = [] @softkeys = [] @icons = [] @refreshTimeout = 0 @timeout = 0 end |
Instance Method Details
#addIcon(index, icon) ⇒ Object
Add an icon to be used by either a softkey of PhoneTextMenu. Only available on the 55i, 57i, and 57iCT. The index is the same as what is referenced by addSoftkey or PhoneTextMenu.addEntry. The icon can be either a predefined icon or the hex of an icon image.
180 181 182 |
# File 'lib/aastra_xml_api/phone.rb', line 180 def addIcon(index, icon) @icons += [PhoneIconEntry.new(index, icon)] end |
#addSoftkey(index, label, uri, icon = nil) ⇒ Object
Add a softkey to be displayed while the XML object is on the screen. Only available on the 9480i, 9480iCT, 55i, 57i, and 57iCT. Softkey will be at position index. label is what is displayed next to the softkey button. uri is what is called when the softkey is pressed. Optionally, icon is the index of the icon to display to the left of the label.
172 173 174 |
# File 'lib/aastra_xml_api/phone.rb', line 172 def addSoftkey(index, label, uri, icon=nil) @softkeys += [PhoneSoftkeyEntry.new(index, escape(label), escape(uri), icon)] end |
#convert_high_ascii(s) ⇒ Object
Convert characters when using double sized text in PhoneFormattedTextScreen.
193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/aastra_xml_api/phone.rb', line 193 def convert_high_ascii(s) ret = "" s.each do |char| if not HIGHASCII[char].nil? then ret += HIGHASCII[char] else ret += char end end return ret end |
#escape(s) ⇒ Object
Convert any HTML characters to the proper escaped format. i.e. > becomes >
186 187 188 189 |
# File 'lib/aastra_xml_api/phone.rb', line 186 def escape(s) return nil if s.nil? CGI.escapeHTML(s) end |
#getRefreshTimeout ⇒ Object
Returns the set refresh timeout value.
157 158 159 |
# File 'lib/aastra_xml_api/phone.rb', line 157 def getRefreshTimeout return @refreshTimeout end |
#getRefreshURL ⇒ Object
Returns the set refresh URI.
162 163 164 |
# File 'lib/aastra_xml_api/phone.rb', line 162 def getRefreshURL return @refreshURL end |
#setAllowAnswer ⇒ Object
Applies only to the non-softkey phones (53i). When set, the phone displays ‘Ignore’ and ‘Answer’ if the XML object is displayed when the phone is ringing.
152 153 154 |
# File 'lib/aastra_xml_api/phone.rb', line 152 def setAllowAnswer @allowAnswer = "yes" end |
#setBeep ⇒ Object
Beep phone when XML is received.
123 124 125 |
# File 'lib/aastra_xml_api/phone.rb', line 123 def setBeep @beep = "yes" end |
#setCancelAction(cancelAction) ⇒ Object
Defines the URI to call when the user cancels the XML object.
133 134 135 |
# File 'lib/aastra_xml_api/phone.rb', line 133 def setCancelAction(cancelAction) @cancelAction = cancelAction end |
#setDestroyOnExit ⇒ Object
Do not keep the object in the phone browser after exit.
128 129 130 |
# File 'lib/aastra_xml_api/phone.rb', line 128 def setDestroyOnExit @destroyOnExit = "yes" end |
#setLockIn ⇒ Object
Ignores all keys that would cause the screen to exit without using keys defined by the object.
139 140 141 |
# File 'lib/aastra_xml_api/phone.rb', line 139 def setLockIn @lockin = "yes" end |
#setRefresh(timeout, url) ⇒ Object
Set refresh timeout (seconds) and the URI to load when the timeout is reached.
117 118 119 120 |
# File 'lib/aastra_xml_api/phone.rb', line 117 def setRefresh(timeout, url) @refreshTimeout = timeout @refreshURL = url end |
#setTimeout(timeout) ⇒ Object
Override the default 45 second timeout. A value of 0 will disable timeout.
145 146 147 |
# File 'lib/aastra_xml_api/phone.rb', line 145 def setTimeout(timeout) @timeout = timeout end |
#setTitle(title) ⇒ Object
Set the title of the Phone object. Typically displayed on the top of the phone.
106 107 108 |
# File 'lib/aastra_xml_api/phone.rb', line 106 def setTitle(title) @title = title end |
#setTitleWrap ⇒ Object
Allow the title to wrap over multiple lines when displayed.
111 112 113 |
# File 'lib/aastra_xml_api/phone.rb', line 111 def setTitleWrap @title_wrap = "yes" end |