The Signal API is used to notify the user of the strength of the WLAN signal. For Windows Mobile / CE, only Symbol devices are supported and it is also possible to display a small indicator showing the available signal. The WLAN signal strength is not available on Windows Phone 8 and therefore this API is not supported on that platform.
In order to use this API you must include the following extension in your build.yml
.
:::ruby
extensions: [“indicators”]
The indicators
extension is also included automatically if you specify the following in your build.yml
.
:::ruby
app_type: “rhoelements”
Note: If you are building a Windows Mobile or Windows CE app with this API, you must set your app_type as “rhoelements” in your build.yml as shown here.
Be sure to review the JavaScript API Usage guide for important information about using this API in JavaScript.
Be sure to review the Ruby API Usage guide for important information about using this API in Ruby.
Hide the icon if it has been previously set by the ‘showIcon’ call.
(All platforms support wlanStatus which can be used to draw your own level indicator or display an appropriate graphic.)
Synchronous Return:
Method Access:
Rho.SignalIndicators.hideIcon()
Rho::SignalIndicators.hideIcon()
Overlays a small signal icon on top of the view indicating the remaining signal strength. This is particularly useful in full screen applications which cover the system signal level indicator.
(All platforms support wlanStatus which can be used to draw your own level indicator or display an appropriate graphic.)
Parameters
The properties associated with the indicator, its position and colour.
The absolute horizontal position of the indicator in pixels. This value is relative to the screen and not the view, so non-fullscreen applications should take care not to display the indicator off screen.
The absolute vertical position of the indicator in pixels. Positive numbers push the icon towards the bottom of the screen. The value is relative to the screen and not the view, so non-fullscreen applications should take care not to display the indicator off screen.
Sets the orientation of the icon, see the remarks section for illustrations.
Possible Values :
See the remarks section for illustrations of icon layout
See the remarks section for illustrations of icon layout
See the remarks section for illustrations of icon layout
See the remarks section for illustrations of icon layout
The color of the icon. This value must be specified as a Hex value in the format #000000 to #FFFFFF. Alpha values are not supported, i.e. you can only use the component parts RRGGBB.
Synchronous Return:
Method Access:
Rho.SignalIndicators.showIcon(HASH propertyMap)
Rho::SignalIndicators.showIcon(HASH propertyMap)
If the signal is being retrieved via callback, by a previously invoked call to wlanStatus, this method will stop the callback from firing.
Synchronous Return:
Method Access:
Rho.SignalIndicators.stopWlanStatus()
Rho::SignalIndicators.stopWlanStatus()
Retrieve the current signal status. If a callback is provided to retrieve the signal then it will be called periodically at the specified refreshInterval. On Android, instead of being called periodically, the callback will be called when one of the below values changes.
Parameters
Async Callback Returning Parameters: HASH
The signal strength as a value between 0 and 100. Not supported on iOS
Platforms:WM, CE, AndroidThe current ESSID
The Device’s MAC address
The Device’s adapter name
The current DHCP server’s address. Always populated on Android, even on static IP configurations. Not supported on iOS
Platforms:WM, CE, AndroidWhether the unit has a static or DHCP address. Not available on Android and iOS.
Platforms:WMThe current gateway IP address
The device’s IP address
Signal strength in RSSI terms. Not supported on iOS.
Platforms:WM, CE, AndroidThe current subnet mask
The current WINs server IP address. Not available on Android and iOS.
Platforms:WMSynchronous Return:
The signal strength as a value between 0 and 100. Not supported on iOS
Platforms:WM, CE, AndroidThe current ESSID
The Device’s MAC address
The Device’s adapter name
The current DHCP server’s address. Always populated on Android, even on static IP configurations. Not supported on iOS
Platforms:WM, CE, AndroidWhether the unit has a static or DHCP address. Not available on Android and iOS.
Platforms:WMThe current gateway IP address
The device’s IP address
Signal strength in RSSI terms. Not supported on iOS.
Platforms:WM, CE, AndroidThe current subnet mask
The current WINs server IP address. Not available on Android and iOS.
Platforms:WMMethod Access:
Rho.SignalIndicators.wlanStatus(CallBackHandler callback)
Rho::SignalIndicators.wlanStatus(CallBackHandler callback)
A callback to retrieve the signal strength can be specified to occur periodically with the wlanStatus method. This value specifies the periodicity of the callback as well as the update frequency of the indicator icon, if shown. On Android this value is not used as the signal icon will be updated as soon as the signal strength changes.
Default: 5000
Property Access:
myObject.refreshInterval
Synchronously: If you are only interested in the current signal state, for example to decide whether to perform some online operation then you can immediately determine the WLAN status as follows
function signal_status_sync(){ signalValue = Rho.SignalIndicators.wlanStatus; console.log(signalValue); console.log("Signal Strength is: " + signalValue['signalStrength']); }
def signal_status_sync signalValue = Rho::SignalIndicators.wlanStatus puts signalValue puts "Signal Strength is: " + signalValue['signalStrength'] end
Asynchronously: If you want to be notified of changes to the WLAN signal then you can register to receive values through a callback
function signal_status_async(){ console.log("Registering Signal Callback"); Rho.SignalIndicators.wlanStatus(signalEvent); } function signalEvent(params){ console.log("Signal Event: (Asynchronous). Strength: " + params["signalStrength"] + ", ESS ID: " + params["essid"] + ", MacAddress: " + params["macAddress"] + ", AdapterName: " + params["adapterName"] + ", DHCP Server: " + params["dhcpServer"] + ", DHCP Static: " + params["dhcpStatic"] + ", Gateway: " + params["gateway"] + ", IP Address: " + params["ipAddress"] + ", RSSI: " + params["rssi"] + ", Subnet Mask: " + params["subnetMask"] + ", Wins: " + params["wins"]); }
def signal_status_async puts "Registering Signal Callback" Rho::SignalIndicators.wlanStatus(url_for(:action => :signalEvent)) end def signalEvent puts "Signal Event: (Asynchronous). Strength: #{@params["signalStrength"]}, ESS ID: #{@params["essid"]}, MacAddress: #{@params["macAddress"]}, AdapterName: #{@params["adapterName"]}, DHCP Server: #{@params["dhcpServer"]}, DHCP Static: #{@params["dhcpStatic"]}, Gateway: #{@params["gateway"]}, IP Address: #{@params["ipAddress"]}, RSSI: #{@params["rssi"]}, Subnet Mask: #{@params["subnetMask"]}, Wins: #{@params["wins"]}" end
If you just want to display the signal indicator in the default position and default colour then call as follows
function show_signal_icon(){ Rho.SignalIndicators.showIcon({}); }
def show_signal_icon Rho::SignalIndicators.showIcon({}) end
To display the signal icon at the default position but blue and vertical specify as follows
function show_signal_icon(){ Rho.SignalIndicators.showIcon({color:'#0000FF',layout: Rho.SignalIndicators.SIGNAL_LAYOUT_UP}); }
def show_signal_icon Rho::SignalIndicators.showIcon({color:'#0000FF',layout: Rho::SignalIndicators.SIGNAL_LAYOUT_UP}) end
The position of the signal and battery indicators should not be set to overlap
The indicator positions are absolute and so when rotating the screen you should also move the indicator positions accordingly to accommodate the new screen layout.