rhodes 3.1.0.beta.3 → 3.1.0.beta.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +4 -4
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_bluetooth_RhoBluetoothManager.h +9 -3
- data/platform/android/Rhodes/jni/src/bluetooth.cpp +63 -40
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/IRhoBluetoothManager.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +13 -9
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java +9 -9
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerOld.java +5 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/AnnotationsOverlay.java +8 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java +38 -7
- data/platform/android/build/androidcommon.rb +0 -2
- data/platform/iphone/Classes/Bluetooth/Bluetooth.m +2 -2
- data/platform/shared/qt/rhodes/impl/BluetoothImpl.cpp +2 -2
- data/platform/shared/ruby/ext/bluetooth/bluetooth.i +2 -2
- data/platform/shared/ruby/ext/bluetooth/bluetooth_wrap.c +422 -144
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +4 -4
- data/platform/wm/rhodes/bluetooth/Bluetooth.h +1 -1
- data/res/generators/templates/application/app/Settings/controller.rb +1 -0
- data/res/generators/templates/application/app/layout.erb +16 -4
- data/res/generators/templates/application/public/css/android.css +9 -0
- data/res/generators/templates/application/public/css/blackberry.css +9 -0
- data/res/generators/templates/application/public/css/iphone.css +55 -46
- data/res/generators/templates/application/public/css/jqmobile-patch.css +15 -2
- data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0b1.css → jquery.mobile-1.0b2.css} +163 -184
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0b1.js → jquery.mobile-1.0b2.js} +3405 -2772
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0b2.min.css +8 -0
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0b2.min.js +155 -0
- data/res/generators/templates/application/public/js/jqmobile-patch.js +58 -10
- data/rhodes.gemspec +1 -1
- metadata +10 -10
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0b1.min.css +0 -8
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0b1.min.js +0 -146
data/Manifest.txt
CHANGED
@@ -4584,10 +4584,10 @@ res/generators/templates/application/public/jqmobile/images/icons-18-black.png
|
|
4584
4584
|
res/generators/templates/application/public/jqmobile/images/icons-18-white.png
|
4585
4585
|
res/generators/templates/application/public/jqmobile/images/icons-36-black.png
|
4586
4586
|
res/generators/templates/application/public/jqmobile/images/icons-36-white.png
|
4587
|
-
res/generators/templates/application/public/jqmobile/jquery.mobile-1.
|
4588
|
-
res/generators/templates/application/public/jqmobile/jquery.mobile-1.
|
4589
|
-
res/generators/templates/application/public/jqmobile/jquery.mobile-1.
|
4590
|
-
res/generators/templates/application/public/jqmobile/jquery.mobile-1.
|
4587
|
+
res/generators/templates/application/public/jqmobile/jquery.mobile-1.0b2.css
|
4588
|
+
res/generators/templates/application/public/jqmobile/jquery.mobile-1.0b2.js
|
4589
|
+
res/generators/templates/application/public/jqmobile/jquery.mobile-1.0b2.min.css
|
4590
|
+
res/generators/templates/application/public/jqmobile/jquery.mobile-1.0b2.min.js
|
4591
4591
|
res/generators/templates/application/public/jqmobile/jquery.mobile.iphone.css
|
4592
4592
|
res/generators/templates/application/public/jquery/jquery-1.6.2.js
|
4593
4593
|
res/generators/templates/application/public/jquery/jquery-1.6.2.min.js
|
@@ -1,16 +1,22 @@
|
|
1
1
|
/* DO NOT EDIT THIS FILE - it is machine generated */
|
2
2
|
#include <jni.h>
|
3
|
-
/* Header for class
|
3
|
+
/* Header for class com_rhomobile_rhodes_bluetooth_RhoBluetoothManager */
|
4
4
|
|
5
5
|
#ifndef _Included_com_rhomobile_rhodes_bluetooth_RhoBluetoothManager
|
6
6
|
#define _Included_com_rhomobile_rhodes_bluetooth_RhoBluetoothManager
|
7
7
|
#ifdef __cplusplus
|
8
8
|
extern "C" {
|
9
9
|
#endif
|
10
|
+
#undef com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_OK
|
11
|
+
#define com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_OK 0L
|
12
|
+
#undef com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_CANCEL
|
13
|
+
#define com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_CANCEL 2L
|
14
|
+
#undef com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_ERROR
|
15
|
+
#define com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_ERROR 3L
|
10
16
|
/*
|
11
17
|
* Class: com_rhomobile_rhodes_bluetooth_RhoBluetoothManager
|
12
|
-
* Method:
|
13
|
-
* Signature: (Ljava/lang/String;Ljava/lang/String;
|
18
|
+
* Method: onCallback
|
19
|
+
* Signature: (Ljava/lang/String;Ljava/lang/String;)V
|
14
20
|
*/
|
15
21
|
JNIEXPORT void JNICALL Java_com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_onCallback
|
16
22
|
(JNIEnv *, jclass, jstring, jstring);
|
@@ -40,13 +40,17 @@
|
|
40
40
|
#include <common/rhoparams.h>
|
41
41
|
|
42
42
|
#undef DEFAULT_LOGCATEGORY
|
43
|
-
#define DEFAULT_LOGCATEGORY "
|
43
|
+
#define DEFAULT_LOGCATEGORY "BluetoothJNI"
|
44
44
|
|
45
45
|
#include "rhodes/jni/com_rhomobile_rhodes_bluetooth_RhoBluetoothManager.h"
|
46
46
|
|
47
47
|
#include <common/RhodesApp.h>
|
48
48
|
#include "ruby/ext/rho/rhoruby.h"
|
49
49
|
|
50
|
+
static const char* const BTC_OK = "OK";
|
51
|
+
static const char* const BTC_CANCEL = "CANCEL";
|
52
|
+
static const char* const BTC_ERROR = "ERROR";
|
53
|
+
|
50
54
|
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_onCallback
|
51
55
|
(JNIEnv *env, jclass, jstring callback_url, jstring body)
|
52
56
|
{
|
@@ -80,43 +84,63 @@ RHO_GLOBAL void rho_bluetooth_set_device_name(const char* device_name) {
|
|
80
84
|
if (!cls) return;
|
81
85
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "set_device_name", "(Ljava/lang/String;)V");
|
82
86
|
if (!mid) return;
|
83
|
-
jhstring objDeviceName = rho_cast<jhstring>(device_name);
|
87
|
+
jhstring objDeviceName = rho_cast<jhstring>(env, device_name);
|
84
88
|
env->CallStaticVoidMethod(cls, mid, objDeviceName.get());
|
85
89
|
}
|
86
90
|
|
87
|
-
RHO_GLOBAL
|
91
|
+
RHO_GLOBAL VALUE rho_bluetooth_get_device_name() {
|
88
92
|
JNIEnv *env = jnienv();
|
89
93
|
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
90
|
-
if (!cls) return
|
94
|
+
if (!cls) return rho_ruby_get_NIL();
|
91
95
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "get_device_name", "()Ljava/lang/String;");
|
92
|
-
if (!mid) return
|
93
|
-
jstring
|
94
|
-
if (!
|
95
|
-
|
96
|
-
RAWLOG_INFO1("rho_bluetooth_get_device_name() : %s",
|
97
|
-
return
|
96
|
+
if (!mid) return rho_ruby_get_NIL();
|
97
|
+
jstring jname = static_cast<jstring>(env->CallStaticObjectMethod(cls, mid));
|
98
|
+
if (!jname) return rho_ruby_get_NIL();
|
99
|
+
std::string name = rho_cast<std::string>(env, jname);
|
100
|
+
RAWLOG_INFO1("rho_bluetooth_get_device_name() : %s", name.c_str());
|
101
|
+
return rho_ruby_create_string(name.c_str());
|
98
102
|
}
|
99
103
|
|
100
104
|
RHO_GLOBAL const char* rho_bluetooth_get_last_error() {
|
101
105
|
JNIEnv *env = jnienv();
|
102
106
|
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
103
|
-
if (!cls) return
|
104
|
-
jmethodID mid = getJNIClassStaticMethod(env, cls, "get_last_error", "()
|
105
|
-
if (!mid) return
|
106
|
-
|
107
|
-
|
107
|
+
if (!cls) return "";
|
108
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "get_last_error", "()I");
|
109
|
+
if (!mid) return "";
|
110
|
+
jint res = env->CallStaticIntMethod(cls, mid);
|
111
|
+
switch(res)
|
112
|
+
{
|
113
|
+
case com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_OK:
|
114
|
+
return BTC_OK;
|
115
|
+
case com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_CANCEL:
|
116
|
+
return BTC_CANCEL;
|
117
|
+
case com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_ERROR:
|
118
|
+
return BTC_ERROR;
|
119
|
+
}
|
120
|
+
//unreachable point
|
121
|
+
return "";
|
108
122
|
}
|
109
123
|
|
110
124
|
RHO_GLOBAL const char* rho_bluetooth_create_session(const char* role, const char* callback_url) {
|
111
125
|
JNIEnv *env = jnienv();
|
112
126
|
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
113
|
-
if (!cls) return
|
114
|
-
jmethodID mid = getJNIClassStaticMethod(env, cls, "create_session", "(Ljava/lang/String;Ljava/lang/String;)
|
115
|
-
if (!mid) return
|
116
|
-
jhstring objStr1 = rho_cast<jhstring>(role);
|
117
|
-
jhstring objStr2 = rho_cast<jhstring>(callback_url);
|
118
|
-
|
119
|
-
|
127
|
+
if (!cls) return BTC_ERROR;
|
128
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "create_session", "(Ljava/lang/String;Ljava/lang/String;)I");
|
129
|
+
if (!mid) return BTC_ERROR;
|
130
|
+
jhstring objStr1 = rho_cast<jhstring>(env, role);
|
131
|
+
jhstring objStr2 = rho_cast<jhstring>(env, callback_url);
|
132
|
+
jint res = env->CallStaticIntMethod(cls, mid, objStr1.get(), objStr2.get());
|
133
|
+
switch(res)
|
134
|
+
{
|
135
|
+
case com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_OK:
|
136
|
+
return BTC_OK;
|
137
|
+
case com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_CANCEL:
|
138
|
+
return BTC_CANCEL;
|
139
|
+
case com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_BTC_ERROR:
|
140
|
+
return BTC_ERROR;
|
141
|
+
}
|
142
|
+
//unreachable point
|
143
|
+
return "";
|
120
144
|
}
|
121
145
|
|
122
146
|
|
@@ -126,8 +150,8 @@ RHO_GLOBAL const char* rho_bluetooth_create_custom_server_session(const char* cl
|
|
126
150
|
if (!cls) return 0;
|
127
151
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "create_custom_server_session", "(Ljava/lang/String;Ljava/lang/String;)V");
|
128
152
|
if (!mid) return 0;
|
129
|
-
jhstring objStr1 = rho_cast<jhstring>(client_name);
|
130
|
-
jhstring objStr2 = rho_cast<jhstring>(callback_url);
|
153
|
+
jhstring objStr1 = rho_cast<jhstring>(env, client_name);
|
154
|
+
jhstring objStr2 = rho_cast<jhstring>(env, callback_url);
|
131
155
|
env->CallStaticObjectMethod(cls, mid, objStr1.get(), objStr2.get());
|
132
156
|
return "OK";
|
133
157
|
}
|
@@ -138,8 +162,8 @@ RHO_GLOBAL const char* rho_bluetooth_create_custom_client_session(const char* se
|
|
138
162
|
if (!cls) return 0;
|
139
163
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "create_custom_client_session", "(Ljava/lang/String;Ljava/lang/String;)V");
|
140
164
|
if (!mid) return 0;
|
141
|
-
jhstring objStr1 = rho_cast<jhstring>(server_name);
|
142
|
-
jhstring objStr2 = rho_cast<jhstring>(callback_url);
|
165
|
+
jhstring objStr1 = rho_cast<jhstring>(env, server_name);
|
166
|
+
jhstring objStr2 = rho_cast<jhstring>(env, callback_url);
|
143
167
|
env->CallStaticObjectMethod(cls, mid, objStr1.get(), objStr2.get());
|
144
168
|
return "OK";
|
145
169
|
}
|
@@ -162,8 +186,8 @@ RHO_GLOBAL void rho_bluetooth_session_set_callback(const char* connected_device_
|
|
162
186
|
if (!cls) return;
|
163
187
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_set_callback", "(Ljava/lang/String;Ljava/lang/String;)V");
|
164
188
|
if (!mid) return;
|
165
|
-
jhstring objStr1 = rho_cast<jhstring>(connected_device_name);
|
166
|
-
jhstring objStr2 = rho_cast<jhstring>(callback_url);
|
189
|
+
jhstring objStr1 = rho_cast<jhstring>(env, connected_device_name);
|
190
|
+
jhstring objStr2 = rho_cast<jhstring>(env, callback_url);
|
167
191
|
env->CallStaticVoidMethod(cls, mid, objStr1.get(), objStr2.get());
|
168
192
|
}
|
169
193
|
|
@@ -173,7 +197,7 @@ RHO_GLOBAL void rho_bluetooth_session_disconnect(const char* connected_device_na
|
|
173
197
|
if (!cls) return;
|
174
198
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_disconnect", "(Ljava/lang/String;)V");
|
175
199
|
if (!mid) return;
|
176
|
-
jhstring objStr1 = rho_cast<jhstring>(connected_device_name);
|
200
|
+
jhstring objStr1 = rho_cast<jhstring>(env, connected_device_name);
|
177
201
|
env->CallStaticVoidMethod(cls, mid, objStr1.get());
|
178
202
|
}
|
179
203
|
|
@@ -183,7 +207,7 @@ RHO_GLOBAL int rho_bluetooth_session_get_status(const char* connected_device_nam
|
|
183
207
|
if (!cls) return 0;
|
184
208
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_get_status", "(Ljava/lang/String;)I");
|
185
209
|
if (!mid) return 0;
|
186
|
-
jhstring objStr1 = rho_cast<jhstring>(connected_device_name);
|
210
|
+
jhstring objStr1 = rho_cast<jhstring>(env, connected_device_name);
|
187
211
|
return env->CallStaticIntMethod(cls, mid, objStr1.get());
|
188
212
|
}
|
189
213
|
|
@@ -193,11 +217,10 @@ RHO_GLOBAL VALUE rho_bluetooth_session_read_string(const char* connected_device_
|
|
193
217
|
if (!cls) return 0;
|
194
218
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_read_string", "(Ljava/lang/String;)Ljava/lang/String;");
|
195
219
|
if (!mid) return 0;
|
196
|
-
jhstring objStr1 = rho_cast<jhstring>(connected_device_name);
|
220
|
+
jhstring objStr1 = rho_cast<jhstring>(env, connected_device_name);
|
197
221
|
jstring res = (jstring)env->CallStaticObjectMethod(cls, mid, objStr1.get());
|
198
|
-
|
199
|
-
return rho_ruby_create_string(msg);
|
200
|
-
//return rho_cast<std::string>(res).c_str();
|
222
|
+
std::string msg = rho_cast<std::string>(env, res);
|
223
|
+
return rho_ruby_create_string(msg.c_str());
|
201
224
|
}
|
202
225
|
|
203
226
|
RHO_GLOBAL void rho_bluetooth_session_write_string(const char* connected_device_name, const char* str) {
|
@@ -206,8 +229,8 @@ RHO_GLOBAL void rho_bluetooth_session_write_string(const char* connected_device_
|
|
206
229
|
if (!cls) return;
|
207
230
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_write_string", "(Ljava/lang/String;Ljava/lang/String;)V");
|
208
231
|
if (!mid) return;
|
209
|
-
jhstring objStr1 = rho_cast<jhstring>(connected_device_name);
|
210
|
-
jhstring objStr2 = rho_cast<jhstring>(str);
|
232
|
+
jhstring objStr1 = rho_cast<jhstring>(env, connected_device_name);
|
233
|
+
jhstring objStr2 = rho_cast<jhstring>(env, str);
|
211
234
|
env->CallStaticVoidMethod(cls, mid, objStr1.get(), objStr2.get());
|
212
235
|
}
|
213
236
|
|
@@ -217,13 +240,13 @@ RHO_GLOBAL VALUE rho_bluetooth_session_read_data(const char* connected_device_na
|
|
217
240
|
if (!cls) return 0;
|
218
241
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_read_data", "(Ljava/lang/String;[BI)I");
|
219
242
|
if (!mid) return 0;
|
220
|
-
jhstring objStr1 = rho_cast<jhstring>(connected_device_name);
|
243
|
+
jhstring objStr1 = rho_cast<jhstring>(env, connected_device_name);
|
221
244
|
|
222
245
|
int buf_size = env->CallStaticIntMethod(cls, mid, objStr1.get(), 0, 0);
|
223
246
|
|
224
247
|
if (buf_size == 0) {
|
225
248
|
// nothing for receive
|
226
|
-
|
249
|
+
return rho_ruby_get_NIL();
|
227
250
|
}
|
228
251
|
|
229
252
|
jholder<jbyteArray> buf_j = jholder<jbyteArray>(env->NewByteArray(buf_size));
|
@@ -232,7 +255,7 @@ RHO_GLOBAL VALUE rho_bluetooth_session_read_data(const char* connected_device_na
|
|
232
255
|
jbyte* buf_p = env->GetByteArrayElements(buf_j.get(), 0);
|
233
256
|
|
234
257
|
VALUE val = rho_ruby_create_byte_array((unsigned char*)buf_p, real_readed);
|
235
|
-
|
258
|
+
|
236
259
|
env->ReleaseByteArrayElements(buf_j.get(), buf_p, 0);
|
237
260
|
|
238
261
|
return val;
|
@@ -253,7 +276,7 @@ RHO_GLOBAL void rho_bluetooth_session_write_data(const char* connected_device_na
|
|
253
276
|
if (!cls) return;
|
254
277
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_write_data", "(Ljava/lang/String;[BI)V");
|
255
278
|
if (!mid) return;
|
256
|
-
jhstring objStr1 = rho_cast<jhstring>(connected_device_name);
|
279
|
+
jhstring objStr1 = rho_cast<jhstring>(env, connected_device_name);
|
257
280
|
|
258
281
|
jholder<jbyteArray> buf_j = jholder<jbyteArray>(env->NewByteArray(size));
|
259
282
|
jbyte* buf_p = env->GetByteArrayElements(buf_j.get(), 0);
|
@@ -40,9 +40,9 @@ public interface IRhoBluetoothManager {
|
|
40
40
|
|
41
41
|
public String get_device_name();
|
42
42
|
|
43
|
-
public
|
43
|
+
public int get_last_error();
|
44
44
|
|
45
|
-
public
|
45
|
+
public int create_session(String role, String callback_url);
|
46
46
|
|
47
47
|
public void session_set_callback(String connected_device_name, String callback_url);
|
48
48
|
|
@@ -35,12 +35,16 @@ import com.rhomobile.rhodes.util.PerformOnUiThread;
|
|
35
35
|
|
36
36
|
public class RhoBluetoothManager {
|
37
37
|
|
38
|
-
public static
|
39
|
-
public static
|
40
|
-
public static
|
38
|
+
public static final int BTC_OK = 0; //"OK";
|
39
|
+
public static final int BTC_CANCEL = 2; //"CANCEL";
|
40
|
+
public static final int BTC_ERROR = 3; //"ERROR";
|
41
41
|
|
42
|
-
public static String
|
43
|
-
public static String
|
42
|
+
public static final String BTC_OK_STRING = "OK";
|
43
|
+
public static final String BTC_CANCEL_STRING = "CANCEL";
|
44
|
+
public static final String BTC_ERROR_STRING = "ERROR";
|
45
|
+
|
46
|
+
public static final String BT_ROLE_SERVER = "ROLE_SERVER";
|
47
|
+
public static final String BT_ROLE_CLIENT = "ROLE_CLIENT";
|
44
48
|
|
45
49
|
private static final String TAG = "RhoBluetoothManager";
|
46
50
|
|
@@ -71,7 +75,7 @@ public class RhoBluetoothManager {
|
|
71
75
|
|
72
76
|
public static IRhoBluetoothManager sharedInstance() {
|
73
77
|
if (ourInstance == null) {
|
74
|
-
PerformOnUiThread.
|
78
|
+
PerformOnUiThread.sync_exec( new Runnable() {
|
75
79
|
public void run() {
|
76
80
|
RhoBluetoothManager.logi(TAG, "make IRhoBluetoothManager instance");
|
77
81
|
String className = "RhoBluetoothManagerNew";
|
@@ -93,7 +97,7 @@ public class RhoBluetoothManager {
|
|
93
97
|
throw new IllegalStateException(e);
|
94
98
|
}
|
95
99
|
}
|
96
|
-
}
|
100
|
+
});
|
97
101
|
}
|
98
102
|
return ourInstance;
|
99
103
|
}
|
@@ -115,11 +119,11 @@ public class RhoBluetoothManager {
|
|
115
119
|
return sharedInstance().get_device_name();
|
116
120
|
}
|
117
121
|
|
118
|
-
public static
|
122
|
+
public static int get_last_error() {
|
119
123
|
return sharedInstance().get_last_error();
|
120
124
|
}
|
121
125
|
|
122
|
-
public static
|
126
|
+
public static int create_session(String role, String callback_url) {
|
123
127
|
return sharedInstance().create_session(role, callback_url);
|
124
128
|
}
|
125
129
|
|
@@ -214,7 +214,7 @@ public class RhoBluetoothManagerNew implements IRhoBluetoothManager {
|
|
214
214
|
mInputBufferSize = 0;
|
215
215
|
PerformOnUiThread.exec( new Runnable() {
|
216
216
|
public void run() {
|
217
|
-
fireCreateSessionCallback(RhoBluetoothManager.
|
217
|
+
fireCreateSessionCallback(RhoBluetoothManager.BTC_OK_STRING, mConnectedDeviceName);
|
218
218
|
}
|
219
219
|
});
|
220
220
|
}
|
@@ -224,7 +224,7 @@ public class RhoBluetoothManagerNew implements IRhoBluetoothManager {
|
|
224
224
|
PerformOnUiThread.exec( new Runnable() {
|
225
225
|
public void run() {
|
226
226
|
if (sharedInstance().getSession().getCallbackURL() == null) {
|
227
|
-
fireCreateSessionCallback(RhoBluetoothManager.
|
227
|
+
fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
|
228
228
|
}
|
229
229
|
else {
|
230
230
|
fireSessionCallback(mConnectedDeviceName, RhoBluetoothSession.BT_SESSION_DISCONNECT);
|
@@ -310,7 +310,7 @@ public class RhoBluetoothManagerNew implements IRhoBluetoothManager {
|
|
310
310
|
//finish();
|
311
311
|
PerformOnUiThread.exec( new Runnable() {
|
312
312
|
public void run() {
|
313
|
-
fireCreateSessionCallback(RhoBluetoothManager.
|
313
|
+
fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
|
314
314
|
}
|
315
315
|
});
|
316
316
|
}
|
@@ -341,7 +341,7 @@ public class RhoBluetoothManagerNew implements IRhoBluetoothManager {
|
|
341
341
|
}
|
342
342
|
else {
|
343
343
|
RhoBluetoothManager.logi(TAG, " mBluetoothAdapter == null");
|
344
|
-
sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.
|
344
|
+
sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
|
345
345
|
}
|
346
346
|
}
|
347
347
|
});
|
@@ -368,7 +368,7 @@ public class RhoBluetoothManagerNew implements IRhoBluetoothManager {
|
|
368
368
|
}
|
369
369
|
else {
|
370
370
|
RhoBluetoothManager.logi(TAG, " mBluetoothAdapter == null");
|
371
|
-
sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.
|
371
|
+
sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
|
372
372
|
}
|
373
373
|
}
|
374
374
|
});
|
@@ -400,12 +400,12 @@ public class RhoBluetoothManagerNew implements IRhoBluetoothManager {
|
|
400
400
|
return sharedInstance().mDeviceName;
|
401
401
|
}
|
402
402
|
|
403
|
-
public
|
403
|
+
public int get_last_error() {
|
404
404
|
if (!mBluetoothIsEnabled) return RhoBluetoothManager.BTC_ERROR;
|
405
405
|
return RhoBluetoothManager.BTC_OK;
|
406
406
|
}
|
407
407
|
|
408
|
-
public
|
408
|
+
public int create_session(String role, String callback_url) {
|
409
409
|
if (!mBluetoothIsEnabled) return RhoBluetoothManager.BTC_ERROR;
|
410
410
|
RhoBluetoothManager.logi(TAG, "create_session("+role+", "+callback_url+");");
|
411
411
|
|
@@ -469,7 +469,7 @@ public class RhoBluetoothManagerNew implements IRhoBluetoothManager {
|
|
469
469
|
}
|
470
470
|
|
471
471
|
public String session_read_string(String connected_device_name) {
|
472
|
-
if (!mBluetoothIsEnabled) return RhoBluetoothManager.
|
472
|
+
if (!mBluetoothIsEnabled) return RhoBluetoothManager.BTC_ERROR_STRING;
|
473
473
|
RhoBluetoothManager.logi(TAG, "session_read_string");
|
474
474
|
//String t = sharedInstance().mInput.toString();
|
475
475
|
//sharedInstance().mInput.setLength(0);
|
@@ -576,7 +576,7 @@ public class RhoBluetoothManagerNew implements IRhoBluetoothManager {
|
|
576
576
|
}
|
577
577
|
}
|
578
578
|
}
|
579
|
-
sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.
|
579
|
+
sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
|
580
580
|
}
|
581
581
|
});
|
582
582
|
}
|
@@ -75,12 +75,12 @@ public class RhoBluetoothManagerOld implements IRhoBluetoothManager {
|
|
75
75
|
return "";
|
76
76
|
}
|
77
77
|
|
78
|
-
public
|
78
|
+
public int get_last_error() {
|
79
79
|
return RhoBluetoothManager.BTC_ERROR;
|
80
80
|
}
|
81
81
|
|
82
|
-
public
|
83
|
-
fireCreateSessionCallback(RhoBluetoothManager.
|
82
|
+
public int create_session(String role, String callback_url) {
|
83
|
+
fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
|
84
84
|
return RhoBluetoothManager.BTC_ERROR;
|
85
85
|
}
|
86
86
|
|
@@ -116,12 +116,12 @@ public class RhoBluetoothManagerOld implements IRhoBluetoothManager {
|
|
116
116
|
}
|
117
117
|
|
118
118
|
public void create_custom_server_session(String client_name, String callback_url) {
|
119
|
-
fireCreateSessionCallback(RhoBluetoothManager.
|
119
|
+
fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
|
120
120
|
return;
|
121
121
|
}
|
122
122
|
|
123
123
|
public void create_custom_client_session(String server_name, String callback_url) {
|
124
|
-
fireCreateSessionCallback(RhoBluetoothManager.
|
124
|
+
fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
|
125
125
|
return;
|
126
126
|
}
|
127
127
|
|
@@ -52,6 +52,14 @@ public class AnnotationsOverlay extends ItemizedOverlay<OverlayItem> {
|
|
52
52
|
populate();
|
53
53
|
}
|
54
54
|
|
55
|
+
public void addAnnotations(Vector<Annotation> anns) {
|
56
|
+
int i;
|
57
|
+
for (i = 0; i < anns.size(); i++) {
|
58
|
+
annotations.addElement(anns.elementAt(i));
|
59
|
+
}
|
60
|
+
populate();
|
61
|
+
}
|
62
|
+
|
55
63
|
@Override
|
56
64
|
protected OverlayItem createItem(int i) {
|
57
65
|
Annotation ann = annotations.elementAt(i);
|
@@ -51,6 +51,7 @@ import com.rhomobile.rhodes.Logger;
|
|
51
51
|
import com.rhomobile.rhodes.RhodesActivity;
|
52
52
|
import com.rhomobile.rhodes.RhodesService;
|
53
53
|
import com.rhomobile.rhodes.util.PerformOnUiThread;
|
54
|
+
import com.rhomobile.rhodes.util.Utils;
|
54
55
|
|
55
56
|
public class GoogleMapView extends MapActivity {
|
56
57
|
|
@@ -264,13 +265,15 @@ public class GoogleMapView extends MapActivity {
|
|
264
265
|
}
|
265
266
|
|
266
267
|
private void doGeocoding() {
|
268
|
+
Vector<Annotation> anns = new Vector<Annotation>();
|
269
|
+
|
267
270
|
Context context = RhodesActivity.getContext();
|
268
271
|
|
269
272
|
for (int i = 0, lim = annotations.size(); i < lim; ++i) {
|
270
273
|
Annotation ann = annotations.elementAt(i);
|
271
274
|
if (ann.latitude == 10000 || ann.longitude == 10000)
|
272
275
|
continue;
|
273
|
-
|
276
|
+
anns.addElement(ann);
|
274
277
|
}
|
275
278
|
|
276
279
|
for (int i = 0, lim = annotations.size(); i < lim; ++i) {
|
@@ -296,19 +299,47 @@ public class GoogleMapView extends MapActivity {
|
|
296
299
|
center.longitude = ann.longitude;
|
297
300
|
controller.setCenter(new GeoPoint((int)(ann.latitude*1000000), (int)(ann.longitude*1000000)));
|
298
301
|
controller.zoomToSpan((int)(spanLat*1000000), (int)(spanLon*1000000));
|
302
|
+
PerformOnUiThread.exec(new Runnable() {
|
303
|
+
public void run() {
|
304
|
+
view.invalidate();
|
305
|
+
}
|
306
|
+
}, false);
|
299
307
|
}
|
300
308
|
else
|
301
|
-
|
309
|
+
anns.addElement(ann);
|
302
310
|
} catch (IOException e) {
|
303
311
|
Logger.E(TAG, "GeoCoding request failed: " + e.getMessage());
|
304
312
|
}
|
305
313
|
|
306
|
-
PerformOnUiThread.exec(new Runnable() {
|
307
|
-
public void run() {
|
308
|
-
view.invalidate();
|
309
|
-
}
|
310
|
-
}, false);
|
311
314
|
}
|
315
|
+
addAnnotationsInUIThread(annOverlay, anns, view);
|
316
|
+
|
317
|
+
PerformOnUiThread.exec(new Runnable() {
|
318
|
+
public void run() {
|
319
|
+
view.invalidate();
|
320
|
+
}
|
321
|
+
}, false);
|
322
|
+
}
|
323
|
+
|
324
|
+
private class AddAnnotationsCommand implements Runnable {
|
325
|
+
public AddAnnotationsCommand(AnnotationsOverlay overlay, Vector<Annotation> annotations, com.google.android.maps.MapView view) {
|
326
|
+
mOverlay = overlay;
|
327
|
+
mAnnotations = annotations;
|
328
|
+
mView = view;
|
329
|
+
}
|
330
|
+
public void run() {
|
331
|
+
//Utils.platformLog(TAG, "add Annotation !");
|
332
|
+
mOverlay.addAnnotations(mAnnotations);
|
333
|
+
mView.invalidate();
|
334
|
+
}
|
335
|
+
private AnnotationsOverlay mOverlay;
|
336
|
+
private Vector<Annotation> mAnnotations;
|
337
|
+
private com.google.android.maps.MapView mView;
|
338
|
+
}
|
339
|
+
|
340
|
+
private void addAnnotationsInUIThread(AnnotationsOverlay overlay, Vector<Annotation> annotations, com.google.android.maps.MapView view) {
|
341
|
+
//Utils.platformLog(TAG, "perform add Annotations !");
|
342
|
+
PerformOnUiThread.exec(new AddAnnotationsCommand(overlay, annotations, view), false);
|
312
343
|
}
|
313
344
|
|
314
345
|
@Override
|
@@ -155,11 +155,9 @@ def cc_def_args
|
|
155
155
|
args << $ndksysroot
|
156
156
|
#args << "-fvisibility=hidden"
|
157
157
|
args << "-fPIC"
|
158
|
-
args << "-fstrict-aliasing"
|
159
158
|
args << "-Wall"
|
160
159
|
args << "-Wextra"
|
161
160
|
args << "-Wno-psabi" if $ndkgccver != "4.2.1"
|
162
|
-
args << "-Wstrict-aliasing"
|
163
161
|
args << "-Wno-sign-compare"
|
164
162
|
args << "-mandroid"
|
165
163
|
args << "-DANDROID"
|
@@ -460,8 +460,8 @@ void rho_bluetooth_set_device_name(const char* device_name) {
|
|
460
460
|
[RhoBluetoothManager sharedInstance].deviceName = newname;
|
461
461
|
}
|
462
462
|
|
463
|
-
|
464
|
-
return [[RhoBluetoothManager sharedInstance].deviceName UTF8String];
|
463
|
+
VALUE rho_bluetooth_get_device_name() {
|
464
|
+
return rho_ruby_create_string([[RhoBluetoothManager sharedInstance].deviceName UTF8String]);
|
465
465
|
}
|
466
466
|
|
467
467
|
const char* rho_bluetooth_get_last_error() {
|
@@ -44,9 +44,9 @@ void rho_bluetooth_set_device_name(const char* device_name)
|
|
44
44
|
{
|
45
45
|
}
|
46
46
|
|
47
|
-
|
47
|
+
VALUE rho_bluetooth_get_device_name()
|
48
48
|
{
|
49
|
-
return "ERROR";
|
49
|
+
return rho_ruby_create_string("ERROR");
|
50
50
|
}
|
51
51
|
|
52
52
|
const char* rho_bluetooth_get_last_error()
|
@@ -4,7 +4,7 @@
|
|
4
4
|
extern int rho_bluetooth_is_bluetooth_available();
|
5
5
|
extern void rho_bluetooth_off_bluetooth();
|
6
6
|
extern void rho_bluetooth_set_device_name(const char* device_name);
|
7
|
-
extern
|
7
|
+
extern VALUE rho_bluetooth_get_device_name();
|
8
8
|
extern const char* rho_bluetooth_get_last_error();
|
9
9
|
extern const char* rho_bluetooth_create_session(const char* role, const char* callback_url);
|
10
10
|
|
@@ -53,7 +53,7 @@ extern void rho_bluetooth_session_write_data(const char* connected_device_name,
|
|
53
53
|
extern int is_bluetooth_available();
|
54
54
|
extern void off_bluetooth();
|
55
55
|
extern void set_device_name(const char* device_name);
|
56
|
-
extern
|
56
|
+
extern VALUE get_device_name();
|
57
57
|
extern const char* get_last_error();
|
58
58
|
extern const char* create_session(const char* role, const char* callback_url);
|
59
59
|
|