This repository has been archived by the owner on Sep 4, 2019. It is now read-only.
/
blackberry_system.js
206 lines (195 loc) · 7.43 KB
/
blackberry_system.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
/*
* Copyright 2010-2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @toc {System} System
* @featureID blackberry.system
* @notice {Warning ( Playbook 1.0 Notice):}
* For URI based APIs, webworks:// has been deprecated and replaced with http://localhost:8472. This change does not affect the procedural APIs.
* @namespace The System object allows you to get access to system level functions and attributes of the BlackBerry PlayBook.<br>
* <br> The System object is static; all of its functions and properties are used directly from the object.
* @example
* <script type="text/javascript">
* // See if we are in coverage
* if (!blackberry.system.hasDataCoverage()) {
* alert("You are not in coverage, we will attempt to send later");
* }
*
* // Check if we have GPS capability
* if (blackberry.system.hasCapability("location.gps")) {
* alert("This PlayBook has a GPS.");
* }
* </script>
*/
blackberry.system ={
/**
* @param {String} capability The capability being checked for.
* @description This method will determine if the BlackBerry PlayBook or the BlackBerry Smartphone device is capable of the given service.<br>
* <br> hasCapability() returns true if the BlackBerry device is capable of the service; false otherwise. <br>
* <br> The supported string values for 'capability' are:
* <br>input.keyboard.issuretype (returns if the user is currently using SureType),
* <br>input.touch,
* <br>media.audio.capture,
* <br>media.video.capture,
* <br>media.recording,
* <br>location.gps,
* <br>location.maps,
* <br>storage.memorycard (checks for an EXTERNAL SD card only),
* <br>network.bluetooth,
* <br>network.wlan (WLAN wireless family includes 802.11, 802.11a, 802.11b, 802.11g),
* <br>network.3gpp (3GPP wireless family includes GPRS, EDGE, UMTS, GERAN, UTRAN, and GAN),
* <br>network.cdma (CDMA wireless family includes CDMA1x and EVDO),
* <br>and network.iden.
* @returns {Boolean} Returns true if the device is capable of the given service.
* @BB50+
* @PB10
*/
hasCapability : function(capability){},
/**
* @function
* @description Returns true if the device is in coverage, otherwise returns false. This can be used in conjunction with the blackberry.network property to find out what kind of coverage it is in.
* @returns {Boolean} Returns true if the BlackBerry PlayBook or the BlackBerry Smartphone device has any network interface active.
* @BB50+
* @PB10
*/
hasDataCoverage : function(){},
/**
* @function
* @description Set the image that appears as the background of the Home screen on a BlackBerry device.
* @param {String} uri URI path to an image file that resides in flash memory or a microSD Card.
* @BB50+
*/
setHomeScreenBackground : function(uri){},
/**
* @param {String} module The BlackBerry WebWorks namespace or class to check for access. For example blackberry.system, blackberry.app.
* @description Determines the level of access to the requested module.
* @returns {Number} The possible return values: 0 - ALLOW 1 - DENY
* @BB50+
* @PB10
*/
hasPermission : function(module){},
/**
* @description Returns whether USB MassStorage mode is active.
* @returns {Boolean} Always returns false on the BlackBerry PlayBook since Mass Storage Mode is not supported. All memory is presented as a network share when connected by USB and is not blocked.
* @BB50+
* @PB10
*/
isMassStorageActive : function(){},
/**
* @uri
* @PB10
* @description The objects in hasPermission will always be ALLOW (0). They will correspond to all the entries in the whitelist. If they are not whitelisted, they are omitted from the list. Similarly, all of the objects in hasCapability will be true, otherwise they will be omitted.
* @returns {JSON of all the properties}
* {
* "data":{
* "hasCapability":[
* "location.gps",
* "media.audio.capture",
* "media.video.capture",
* "media.recording",
* "network.bluetooth",
* "network.wlan"
* ],
* "softwareVersion":"QNX",
* "hasPermission":[
* "blackberry.invoke",
* "blackberry.system",
* "blackberry.app",
* "blackberry.app.event",
* "blackberry.system.event",
* "blackberry.ui.dialog",
* "blackberry.utils"
* ],
* "model":100669958,
* "hasDataCoverage":true,
* "scriptApiVersion":"1.0.0.0",
* "isMassStorageActive":false
* }
* }
* @example
* <html>
* <head>
* <script type="text/javascript" src="js/jquery-1.4.2.js" ></script>
* <script type="text/javascript" src="js/jquery.form.js" ></script>
* <script type="text/javascript" src="js/jquery.populate.js" ></script>
*
* <script type="text/javascript">
* function getSystemData(){
* $.ajax({
* type: "get",
* url: "http://localhost:8472/blackberry/system/get",
* success: function(msg){
* $('#mySystemDiv').populate(JSON.parse(msg).data);
* }
* });
* }
* </script>
*
*</head>
*<body>
*
* <input type="button" onclick="getSystemData();" value="Populate - System"/>
* <div id="mySystemDiv">
* Software Version: <span id="softwareVersion"></span><br/>
* Mass Storage Active: <span id="isMassStorageActive"></span>
* </div>
*
*</body>
*</html>
*/
get: function(){},
/**
* @type String
* @description Returns the model number of the BlackBerry PlayBook or the BlackBerry Smartphone device.
* @readOnly
* @BB50+
* @PB10
*/
model: null,
/**
* @type String
* @description Returns the current version of the WebWorks library being used.
* @readOnly
* @BB50+
* @PB10
*/
scriptApiVersion:null,
/**
* @type String
* @description Returns the current version of the operating system, for example, 1.0.0.0.
* @readOnly
* @BB50+
* @PB10
*/
softwareVersion:null,
/**
* @constant
* @type Number
* @description Returned by hasPermission() indicating that the module requested is accessible.
* @default 0
* @BB50+
* @PB10
*/
ALLOW : 0,
/**
* @constant
* @type Number
* @description Returned by hasPermission() indicating that the module is not accessible.
* @default 1
* @BB50+
* @PB10
*/
DENY:1
};