rhodes 3.2.1 → 3.2.2.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +7 -0
- data/Manifest.txt +36 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/barcode.cpp +24 -3
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/android/CaptureActivity.java +11 -280
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/android/camera/CameraManager.java +11 -4
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/Barcode.java +2 -1
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +36 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.h +25 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.mm +195 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.h +59 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.m +346 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactory.h +7 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactory.mm +58 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactoryRegister.mm +18 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewManager.h +16 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewManager.mm +32 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/barcode.m +9 -2
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCameraSimulator.h +45 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCaptureReader.h +7 -1
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderView.h +21 -4
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderViewController.h +32 -2
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSDK.h +1 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar.h +26 -5
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Decoder.h +1 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Symbol.h +2 -3
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/libzbar.a +0 -0
- data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode.i +3 -2
- data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode_wrap.c +7 -4
- data/lib/extensions/barcode/ext/barcode/shared/src/zbar.c +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraNewService.java +7 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraOldService.java +5 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraSemiService.java +8 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraService.java +4 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +11 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +21 -13
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +33 -11
- data/platform/android/build/android.rake +63 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/icon.png +0 -0
- data/platform/iphone/rbuild/iphone.rake +6 -4
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -1
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +4 -1
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +4 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.Libraries.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Scripting.Core.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Scripting.dll +0 -0
- data/res/generators/rhogen.rb +191 -0
- data/res/generators/templates/extension/app/MontanaTest/controller.rb +20 -0
- data/res/generators/templates/extension/app/MontanaTest/index.erb +17 -0
- data/res/generators/templates/extension/extensions/montana/ext.yml +4 -0
- data/res/generators/templates/extension/extensions/montana/ext/build +17 -0
- data/res/generators/templates/extension/extensions/montana/ext/build.bat +36 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/Rakefile +77 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/ext_build.files +1 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/jni/src/montana.cpp +28 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/src/com/montana/Montana.java +10 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/Montana.files +1 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/Rakefile +97 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/montana.jdp +48 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/src/com/montana/Montana.java +118 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Classes/Montana.h +4 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Classes/Montana.m +24 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Montana.xcodeproj/project.pbxproj +300 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Montana_Prefix.pch +7 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Rakefile +74 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Montana.vcproj +331 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Rakefile +62 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/src/montana_wm.cpp +40 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/src/montana_wm.h +2 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/shared/ruby/montana.i +15 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/shared/ruby/montana_wrap.c +2287 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/shared/src/montana.c +20 -0
- data/res/generators/templates/extension/extensions/montana/montana.rb +13 -0
- data/spec/framework_spec/build.yml +1 -1
- data/spec/phone_spec/build.yml +1 -1
- data/version +1 -1
- metadata +42 -5
data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Symbol.h
CHANGED
|
@@ -316,6 +316,7 @@ public:
|
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
/// retrieve the string name for any addon.
|
|
319
|
+
/// @deprecated in 0.11
|
|
319
320
|
const std::string get_addon_name () const
|
|
320
321
|
{
|
|
321
322
|
return(zbar_get_addon_name(_type));
|
|
@@ -518,9 +519,7 @@ inline const SymbolIterator SymbolSet::symbol_end () const {
|
|
|
518
519
|
static inline std::ostream& operator<< (std::ostream& out,
|
|
519
520
|
const Symbol& sym)
|
|
520
521
|
{
|
|
521
|
-
out << sym.get_type_name()
|
|
522
|
-
<< sym.get_addon_name()
|
|
523
|
-
<< ":" << sym.get_data();
|
|
522
|
+
out << sym.get_type_name() << ":" << sym.get_data();
|
|
524
523
|
return(out);
|
|
525
524
|
}
|
|
526
525
|
|
|
Binary file
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* barcode.i */
|
|
2
2
|
%module Barcode
|
|
3
3
|
%{
|
|
4
|
+
#include "ruby/ext/rho/rhoruby.h"
|
|
4
5
|
extern const char* rho_barcode_barcode_recognize(const char* filename);
|
|
5
|
-
extern void rho_barcode_take_barcode(const char* callback);
|
|
6
|
+
extern void rho_barcode_take_barcode(const char* callback, VALUE options);
|
|
6
7
|
|
|
7
8
|
#define barcode_recognize rho_barcode_barcode_recognize
|
|
8
9
|
#define take_barcode rho_barcode_take_barcode
|
|
@@ -10,4 +11,4 @@ extern void rho_barcode_take_barcode(const char* callback);
|
|
|
10
11
|
%}
|
|
11
12
|
|
|
12
13
|
extern const char* barcode_recognize(const char* filename);
|
|
13
|
-
extern void take_barcode(const char* callback);
|
|
14
|
+
extern void take_barcode(const char* callback, VALUE options);
|
|
@@ -1814,8 +1814,9 @@ static VALUE mBarcode;
|
|
|
1814
1814
|
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
|
|
1815
1815
|
|
|
1816
1816
|
|
|
1817
|
+
#include "ruby/ext/rho/rhoruby.h"
|
|
1817
1818
|
extern const char* rho_barcode_barcode_recognize(const char* filename);
|
|
1818
|
-
extern void rho_barcode_take_barcode(const char* callback);
|
|
1819
|
+
extern void rho_barcode_take_barcode(const char* callback, VALUE options);
|
|
1819
1820
|
|
|
1820
1821
|
#define barcode_recognize rho_barcode_barcode_recognize
|
|
1821
1822
|
#define take_barcode rho_barcode_take_barcode
|
|
@@ -1929,19 +1930,21 @@ fail:
|
|
|
1929
1930
|
SWIGINTERN VALUE
|
|
1930
1931
|
_wrap_take_barcode(int argc, VALUE *argv, VALUE self) {
|
|
1931
1932
|
char *arg1 = (char *) 0 ;
|
|
1933
|
+
VALUE arg2 = (VALUE) 0 ;
|
|
1932
1934
|
int res1 ;
|
|
1933
1935
|
char *buf1 = 0 ;
|
|
1934
1936
|
int alloc1 = 0 ;
|
|
1935
1937
|
|
|
1936
|
-
if ((argc <
|
|
1937
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for
|
|
1938
|
+
if ((argc < 2) || (argc > 2)) {
|
|
1939
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
|
|
1938
1940
|
}
|
|
1939
1941
|
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
|
|
1940
1942
|
if (!SWIG_IsOK(res1)) {
|
|
1941
1943
|
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","take_barcode", 1, argv[0] ));
|
|
1942
1944
|
}
|
|
1943
1945
|
arg1 = (char *)(buf1);
|
|
1944
|
-
|
|
1946
|
+
arg2 = argv[1];
|
|
1947
|
+
take_barcode((char const *)arg1,arg2);
|
|
1945
1948
|
if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
|
|
1946
1949
|
return Qnil;
|
|
1947
1950
|
fail:
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
#include "../zbar/zbar/include/zbar.h"
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
#include "ruby/ext/rho/rhoruby.h"
|
|
12
12
|
|
|
13
13
|
static char strbuf[1024];
|
|
14
14
|
|
|
15
|
-
void rho_barcode_take_barcode(const char* callback) {
|
|
15
|
+
void rho_barcode_take_barcode(const char* callback, VALUE options) {
|
|
16
16
|
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -1286,7 +1286,7 @@ public class RhodesService extends Service {
|
|
|
1286
1286
|
|
|
1287
1287
|
private void restartGeoLocationIfNeeded() {
|
|
1288
1288
|
if (mNeedGeoLocationRestart) {
|
|
1289
|
-
GeoLocation.
|
|
1289
|
+
GeoLocation.restart();
|
|
1290
1290
|
mNeedGeoLocationRestart = false;
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
@@ -148,5 +148,10 @@ class CameraNewService implements CameraService {
|
|
|
148
148
|
return new Size(neww, newh);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
public boolean isAutoFocusSupported(android.hardware.Camera camera) {
|
|
152
|
+
String focus_mode = camera.getParameters().getFocusMode();
|
|
153
|
+
boolean auto_focus_supported = (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_AUTO)) || (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_MACRO));
|
|
154
|
+
return auto_focus_supported;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
}
|
|
@@ -137,4 +137,11 @@ class CameraSemiService implements CameraService {
|
|
|
137
137
|
return new Size(neww, newh);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
public boolean isAutoFocusSupported(android.hardware.Camera camera) {
|
|
141
|
+
String focus_mode = camera.getParameters().getFocusMode();
|
|
142
|
+
boolean auto_focus_supported = (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_AUTO)) || (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_MACRO));
|
|
143
|
+
return auto_focus_supported;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
package com.rhomobile.rhodes.camera;
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
interface CameraService {
|
|
30
|
+
public interface CameraService {
|
|
31
31
|
|
|
32
32
|
public class Size {
|
|
33
33
|
public Size(int w, int h) {
|
|
@@ -45,5 +45,7 @@ interface CameraService {
|
|
|
45
45
|
Size getClosestPictureSize(android.hardware.Camera camera, int w, int h);
|
|
46
46
|
|
|
47
47
|
Size getClosestPreviewSize(android.hardware.Camera camera, int w, int h);
|
|
48
|
+
|
|
49
|
+
boolean isAutoFocusSupported(android.hardware.Camera camera);
|
|
48
50
|
|
|
49
|
-
}
|
|
51
|
+
}
|
|
@@ -63,7 +63,7 @@ public class ImageCapture extends BaseActivity implements SurfaceHolder.Callback
|
|
|
63
63
|
private static final String TAG = "ImageCapture";
|
|
64
64
|
|
|
65
65
|
private String callbackUrl;
|
|
66
|
-
private Camera camera;
|
|
66
|
+
private android.hardware.Camera camera;
|
|
67
67
|
private boolean isPreviewRunning = false;
|
|
68
68
|
private SimpleDateFormat timeStampFormat = new SimpleDateFormat("yyyyMMddHHmmssSS");
|
|
69
69
|
|
|
@@ -270,11 +270,16 @@ public class ImageCapture extends BaseActivity implements SurfaceHolder.Callback
|
|
|
270
270
|
//this only from API v.5 and higher
|
|
271
271
|
//String focus_mode = camera.getParameters().getFocusMode();
|
|
272
272
|
//if ((focus_mode != Camera.Parameters.FOCUS_MODE_FIXED) && (focus_mode != Camera.Parameters.FOCUS_MODE_INFINITY)) {
|
|
273
|
-
camera.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
if (com.rhomobile.rhodes.camera.Camera.getCameraService().isAutoFocusSupported(camera)) {
|
|
274
|
+
camera.autoFocus(new Camera.AutoFocusCallback() {
|
|
275
|
+
public void onAutoFocus(boolean success, Camera camera) {
|
|
276
|
+
takePicture();
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
takePicture();
|
|
282
|
+
}
|
|
278
283
|
//}
|
|
279
284
|
}
|
|
280
285
|
|
|
@@ -64,10 +64,6 @@ public class GeoLocation {
|
|
|
64
64
|
return 30000; // 30 sec
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
private static void reportFail(String name, Exception e) {
|
|
68
|
-
Logger.E(TAG, "Call of \"" + name + "\" failed: " + e.getMessage());
|
|
69
|
-
}
|
|
70
|
-
|
|
71
67
|
private static void checkState() throws IllegalAccessException {
|
|
72
68
|
if (!Capabilities.GPS_ENABLED)
|
|
73
69
|
throw new IllegalAccessException("Capability GPS disabled");
|
|
@@ -117,10 +113,22 @@ public class GeoLocation {
|
|
|
117
113
|
}
|
|
118
114
|
}
|
|
119
115
|
catch (Exception e) {
|
|
120
|
-
|
|
116
|
+
Logger.E(TAG, e);
|
|
121
117
|
}
|
|
122
118
|
}
|
|
123
|
-
|
|
119
|
+
|
|
120
|
+
public static void restart() {
|
|
121
|
+
try {
|
|
122
|
+
checkState();
|
|
123
|
+
Logger.T(TAG, "restart");
|
|
124
|
+
if (updatePeriod != -1)
|
|
125
|
+
getImpl().setTimeout(getUpdatePeriod());
|
|
126
|
+
}
|
|
127
|
+
catch (Exception e) {
|
|
128
|
+
Logger.E(TAG, e);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
124
132
|
public static boolean isAvailable() {
|
|
125
133
|
Logger.T(TAG, "isAvailable...");
|
|
126
134
|
try {
|
|
@@ -133,7 +141,7 @@ public class GeoLocation {
|
|
|
133
141
|
return result;
|
|
134
142
|
}
|
|
135
143
|
catch (Exception e) {
|
|
136
|
-
|
|
144
|
+
Logger.E(TAG, e);
|
|
137
145
|
}
|
|
138
146
|
return false;
|
|
139
147
|
}
|
|
@@ -145,7 +153,7 @@ public class GeoLocation {
|
|
|
145
153
|
return getImpl().getLatitude();
|
|
146
154
|
}
|
|
147
155
|
catch (Exception e) {
|
|
148
|
-
|
|
156
|
+
Logger.E(TAG, e);
|
|
149
157
|
}
|
|
150
158
|
return 0.0;
|
|
151
159
|
}
|
|
@@ -157,7 +165,7 @@ public class GeoLocation {
|
|
|
157
165
|
return getImpl().getLongitude();
|
|
158
166
|
}
|
|
159
167
|
catch (Exception e) {
|
|
160
|
-
|
|
168
|
+
Logger.E(TAG, e);
|
|
161
169
|
}
|
|
162
170
|
return 0.0;
|
|
163
171
|
}
|
|
@@ -169,7 +177,7 @@ public class GeoLocation {
|
|
|
169
177
|
return getImpl().getAccuracy();
|
|
170
178
|
}
|
|
171
179
|
catch (Exception e) {
|
|
172
|
-
|
|
180
|
+
Logger.E(TAG, e);
|
|
173
181
|
}
|
|
174
182
|
return 0;
|
|
175
183
|
}
|
|
@@ -181,7 +189,7 @@ public class GeoLocation {
|
|
|
181
189
|
return getImpl().isKnownPosition();
|
|
182
190
|
}
|
|
183
191
|
catch (Exception e) {
|
|
184
|
-
|
|
192
|
+
Logger.E(TAG, e);
|
|
185
193
|
}
|
|
186
194
|
return false;
|
|
187
195
|
}
|
|
@@ -196,10 +204,10 @@ public class GeoLocation {
|
|
|
196
204
|
checkState();
|
|
197
205
|
Logger.T(TAG, "setTimeout: " + nsec + "s");
|
|
198
206
|
updatePeriod = nsec * 1000;
|
|
199
|
-
getImpl().setTimeout(
|
|
207
|
+
getImpl().setTimeout(getUpdatePeriod());
|
|
200
208
|
}
|
|
201
209
|
catch (Exception e) {
|
|
202
|
-
|
|
210
|
+
Logger.E(TAG, e);
|
|
203
211
|
}
|
|
204
212
|
}
|
|
205
213
|
|
|
@@ -48,10 +48,13 @@ public class GeoLocationImpl {
|
|
|
48
48
|
|
|
49
49
|
private LocationManager locationManager = null;
|
|
50
50
|
private volatile Location lastLocation;
|
|
51
|
+
|
|
52
|
+
// These two values should be equal in most cases but explicit request to GeoLocation without call to setTimeout
|
|
51
53
|
private long invalidateLocationPeriod;
|
|
52
54
|
private volatile long pingTimeout = Long.MAX_VALUE;
|
|
53
55
|
|
|
54
56
|
private List<RhoLocationListener> mListeners = new LinkedList<RhoLocationListener>();
|
|
57
|
+
private List<RhoLocationListener> mSwitchedOffListeners = new LinkedList<RhoLocationListener>();
|
|
55
58
|
|
|
56
59
|
public class RhoLocationListener implements LocationListener {
|
|
57
60
|
private String providerName;
|
|
@@ -106,11 +109,11 @@ public class GeoLocationImpl {
|
|
|
106
109
|
if((System.currentTimeMillis() - time) > invalidateLocationPeriod) {
|
|
107
110
|
message.append(" time is very old: ").append(location.getTime());
|
|
108
111
|
message.append(". Current time: ").append(System.currentTimeMillis());
|
|
109
|
-
message.append(".
|
|
112
|
+
message.append(". Invalitate period: ").append(invalidateLocationPeriod).append(".");
|
|
110
113
|
} else {
|
|
111
114
|
message.append(" time os ok: ").append(location.getTime());
|
|
112
115
|
message.append(". Current time: ").append(System.currentTimeMillis());
|
|
113
|
-
message.append(".
|
|
116
|
+
message.append(". Invalidate period: ").append(invalidateLocationPeriod).append(".");
|
|
114
117
|
onLocationChanged(location);
|
|
115
118
|
}
|
|
116
119
|
Logger.T(TAG, message.toString());
|
|
@@ -151,7 +154,7 @@ public class GeoLocationImpl {
|
|
|
151
154
|
if (pingTimeout < 0)
|
|
152
155
|
break;
|
|
153
156
|
try {
|
|
154
|
-
long curTimeout = errorTimeout(pingTimeout);
|
|
157
|
+
final long curTimeout = errorTimeout(pingTimeout);
|
|
155
158
|
Logger.T(TAG, "\"watchdog\" thread waits (" + curTimeout + "ms)...");
|
|
156
159
|
Thread.sleep(curTimeout);
|
|
157
160
|
}
|
|
@@ -183,7 +186,7 @@ public class GeoLocationImpl {
|
|
|
183
186
|
});
|
|
184
187
|
|
|
185
188
|
// Sleep greater then ping time to do not interfere with real location updates
|
|
186
|
-
private static long errorTimeout(long time) { return time * 5;
|
|
189
|
+
private static long errorTimeout(long time) { return (time == Long.MAX_VALUE) ? time : (time * 5); }
|
|
187
190
|
|
|
188
191
|
private static native void geoCallback();
|
|
189
192
|
private static native void geoCallbackError();
|
|
@@ -209,7 +212,7 @@ public class GeoLocationImpl {
|
|
|
209
212
|
continue;
|
|
210
213
|
|
|
211
214
|
RhoLocationListener listener = new RhoLocationListener(provider, locationManager);
|
|
212
|
-
|
|
215
|
+
mSwitchedOffListeners.add(listener);
|
|
213
216
|
}
|
|
214
217
|
}
|
|
215
218
|
|
|
@@ -217,10 +220,18 @@ public class GeoLocationImpl {
|
|
|
217
220
|
private void registerListeners() {
|
|
218
221
|
Iterator<RhoLocationListener> it;
|
|
219
222
|
synchronized (mListeners) {
|
|
220
|
-
it =
|
|
223
|
+
it = mSwitchedOffListeners.iterator();
|
|
221
224
|
while (it.hasNext()) {
|
|
222
|
-
|
|
225
|
+
RhoLocationListener listener = it.next();
|
|
226
|
+
|
|
227
|
+
Logger.T(TAG, "Registering location listener: " + listener.getProviderName());
|
|
228
|
+
|
|
229
|
+
listener.register(pingTimeout);
|
|
230
|
+
mListeners.add(listener);
|
|
223
231
|
}
|
|
232
|
+
mSwitchedOffListeners.removeAll(mListeners);
|
|
233
|
+
|
|
234
|
+
Logger.T(TAG, "Count of switched off listeners: " + mSwitchedOffListeners.size());
|
|
224
235
|
}
|
|
225
236
|
// Request last location after every listener has registered
|
|
226
237
|
// because last location from GPS will force other listeners to unregister
|
|
@@ -237,8 +248,14 @@ public class GeoLocationImpl {
|
|
|
237
248
|
RhoLocationListener listener = it.next();
|
|
238
249
|
if ((skipProvider != null) && listener.getProviderName().equals(skipProvider))
|
|
239
250
|
continue;
|
|
251
|
+
|
|
252
|
+
Logger.T(TAG, "Unregistering location listener: " + listener.getProviderName());
|
|
253
|
+
|
|
240
254
|
listener.unregister();
|
|
255
|
+
it.remove();
|
|
256
|
+
mSwitchedOffListeners.add(listener);
|
|
241
257
|
}
|
|
258
|
+
Logger.T(TAG, "Count of switched off listeners: " + mSwitchedOffListeners.size());
|
|
242
259
|
}
|
|
243
260
|
}
|
|
244
261
|
|
|
@@ -406,10 +423,15 @@ public class GeoLocationImpl {
|
|
|
406
423
|
}
|
|
407
424
|
|
|
408
425
|
synchronized void setTimeout(long msec) {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
426
|
+
if (pingTimeout != msec) {
|
|
427
|
+
pingTimeout = msec;
|
|
428
|
+
thWatchdog.interrupt();
|
|
429
|
+
registerListeners();// do reregister for new timeout
|
|
430
|
+
Logger.T(TAG, "Set new ping timeout: " + pingTimeout + "ms");
|
|
431
|
+
} else {
|
|
432
|
+
// Just renew timer in case same value
|
|
433
|
+
thWatchdog.interrupt();
|
|
434
|
+
}
|
|
413
435
|
|
|
414
436
|
}
|
|
415
437
|
}
|
|
@@ -33,7 +33,21 @@ USE_OWN_STLPORT = false
|
|
|
33
33
|
|
|
34
34
|
ANDROID_API_LEVEL_TO_MARKET_VERSION = {}
|
|
35
35
|
ANDROID_MARKET_VERSION_TO_API_LEVEL = {}
|
|
36
|
-
{
|
|
36
|
+
{
|
|
37
|
+
2 => "1.1",
|
|
38
|
+
3 => "1.5",
|
|
39
|
+
4 => "1.6",
|
|
40
|
+
5 => "2.0",
|
|
41
|
+
6 => "2.0.1",
|
|
42
|
+
7 => "2.1",
|
|
43
|
+
8 => "2.2",
|
|
44
|
+
9 => "2.3.1",
|
|
45
|
+
10 => "2.3.3",
|
|
46
|
+
11 => "3.0",
|
|
47
|
+
12 => "3.1",
|
|
48
|
+
13 => "3.2",
|
|
49
|
+
14 => "4.0"
|
|
50
|
+
}.each do |k,v|
|
|
37
51
|
ANDROID_API_LEVEL_TO_MARKET_VERSION[k] = v
|
|
38
52
|
ANDROID_MARKET_VERSION_TO_API_LEVEL[v] = k
|
|
39
53
|
end
|
|
@@ -245,10 +259,58 @@ def set_app_name_android(newname)
|
|
|
245
259
|
|
|
246
260
|
manifest.elements.each('uses-permission') { |e| manifest.delete e }
|
|
247
261
|
|
|
262
|
+
|
|
263
|
+
uses_camera = false
|
|
264
|
+
uses_autofocus = false
|
|
265
|
+
uses_front = false
|
|
266
|
+
uses_flash = false
|
|
267
|
+
|
|
268
|
+
manifest.elements.each('uses-feature') do |e|
|
|
269
|
+
uname = e.attribute("name", "android").to_s
|
|
270
|
+
if "android.hardware.camera".eql? uname
|
|
271
|
+
uses_camera = true
|
|
272
|
+
end
|
|
273
|
+
if "android.hardware.camera.autofocus".eql? uname
|
|
274
|
+
uses_autofocus = true
|
|
275
|
+
end
|
|
276
|
+
if "android.hardware.camera.front".eql? uname
|
|
277
|
+
uses_front = true
|
|
278
|
+
end
|
|
279
|
+
if "android.hardware.camera.flash".eql? uname
|
|
280
|
+
uses_flash = true
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
|
|
248
284
|
caps.sort.each do |cap|
|
|
249
285
|
element = REXML::Element.new('uses-permission')
|
|
250
286
|
element.add_attribute('android:name', "android.permission.#{cap}")
|
|
251
287
|
manifest.add element
|
|
288
|
+
if cap == 'CAMERA'
|
|
289
|
+
if !uses_camera
|
|
290
|
+
element = REXML::Element.new('uses-feature')
|
|
291
|
+
element.add_attribute('android:required', "false")
|
|
292
|
+
element.add_attribute('android:name', "android.hardware.camera")
|
|
293
|
+
manifest.add element
|
|
294
|
+
end
|
|
295
|
+
if !uses_autofocus
|
|
296
|
+
element = REXML::Element.new('uses-feature')
|
|
297
|
+
element.add_attribute('android:required', "false")
|
|
298
|
+
element.add_attribute('android:name', "android.hardware.camera.autofocus")
|
|
299
|
+
manifest.add element
|
|
300
|
+
end
|
|
301
|
+
if !uses_front
|
|
302
|
+
element = REXML::Element.new('uses-feature')
|
|
303
|
+
element.add_attribute('android:required', "false")
|
|
304
|
+
element.add_attribute('android:name', "android.hardware.camera.front")
|
|
305
|
+
manifest.add element
|
|
306
|
+
end
|
|
307
|
+
if !uses_flash
|
|
308
|
+
element = REXML::Element.new('uses-feature')
|
|
309
|
+
element.add_attribute('android:required', "false")
|
|
310
|
+
element.add_attribute('android:name', "android.hardware.camera.flash")
|
|
311
|
+
manifest.add element
|
|
312
|
+
end
|
|
313
|
+
end
|
|
252
314
|
end
|
|
253
315
|
|
|
254
316
|
caps_proc.each do |p|
|