rhodes 2.3.0 → 2.3.1.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/Manifest.txt +5819 -0
- data/README.md +2 -2
- data/Rakefile +9 -5
- data/doc/build.txt +7 -13
- data/doc/configuration.txt +4 -0
- data/doc/connect-to-web-services.txt +0 -1
- data/doc/device-caps.txt +2 -2
- data/doc/extensions.txt +2 -0
- data/doc/linea.txt +699 -0
- data/doc/rhom.txt +2 -1
- data/doc/synchronization.txt +39 -2
- data/doc/ui.txt +1 -0
- data/installer/README.html +1 -1
- data/lib/build/jake.rb +3 -0
- data/lib/framework/res/esri.wm.png +0 -0
- data/lib/framework/rho/render.rb +2 -0
- data/lib/framework/rho/rho.rb +17 -10
- data/lib/framework/rho/rhoapplication.rb +13 -3
- data/lib/framework/rho/rhoevent_bb.rb +3 -1
- data/lib/framework/rho/rhoevent_c.rb +4 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhom/rhom.rb +10 -0
- data/lib/framework/rhom/rhom_object_factory.rb +45 -0
- data/lib/framework/rhom/rhom_source.rb +1 -1
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/jni/include/rhodes/RhoClassFactory.h +1 -1
- data/platform/android/Rhodes/jni/src/RhoClassFactory.cpp +1 -1
- data/platform/android/Rhodes/jni/src/callbacks.cpp +9 -11
- data/platform/android/Rhodes/jni/src/event.cpp +17 -9
- data/platform/android/Rhodes/jni/src/mapview.cpp +34 -4
- data/platform/android/Rhodes/jni/src/rhodes.cpp +1 -1
- data/platform/android/Rhodes/res/drawable/esri.png +0 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +3 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +8 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +80 -9
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +29 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +4 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +50 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +3 -0
- data/platform/android/build/android.rake +45 -23
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/CachedDataRow.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/CachedRow.java +3 -2
- data/platform/bb/Hsqldb/src/org/hsqldb/Row.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/CachedObject.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/DataFileCache.java +66 -16
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/HsqlDatabaseProperties.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/RhoCrypto.java +116 -0
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +39 -2
- data/platform/bb/RubyVM/src/com/rho/Tokenizer.java +11 -6
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +157 -150
- data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +15 -0
- data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +35 -23
- data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +6 -9
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +54 -16
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +18 -9
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +37 -59
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +3 -0
- data/platform/bb/build/RubyVM_build.files +1 -0
- data/platform/bb/build/bb.rake +4 -5
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +4 -1
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +8 -3
- data/platform/bb/rhodes/resources/esri.png +0 -0
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +2 -0
- data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +8 -3
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +4 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +2 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapField.java +9 -0
- data/platform/iphone/Classes/Event/Event.m +12 -2
- data/platform/iphone/Classes/NativeBar.h +12 -11
- data/platform/iphone/Classes/NativeBar.m +13 -3
- data/platform/iphone/Classes/Rhodes.m +48 -10
- data/platform/iphone/Classes/SimpleMainView.h +1 -0
- data/platform/iphone/Classes/SimpleMainView.m +7 -1
- data/platform/iphone/Classes/SplitView/LeftViewController.m +3 -0
- data/platform/iphone/Classes/SplitView/RightViewController.m +11 -6
- data/platform/iphone/Classes/SplitView/SplittedMainView.m +8 -0
- data/platform/iphone/Classes/TabbedMainView.m +39 -3
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +3 -3
- data/platform/shared/SyncClient/SyncClient.cpp +23 -23
- data/platform/shared/common/IRhoClassFactory.h +6 -4
- data/platform/shared/common/RhoAppAdapter.h +1 -1
- data/platform/shared/common/RhoFile.cpp +10 -0
- data/platform/shared/common/RhoFile.h +1 -0
- data/platform/shared/common/RhoMutexLock.h +1 -1
- data/platform/shared/common/RhoStd.h +5 -0
- data/platform/shared/common/RhoThread.cpp +2 -2
- data/platform/shared/common/RhoThread.h +1 -2
- data/platform/shared/common/RhodesApp.cpp +33 -55
- data/platform/shared/common/RhodesApp.h +0 -5
- data/platform/shared/common/RhodesAppBase.cpp +1 -1
- data/platform/shared/common/SplashScreen.cpp +1 -2
- data/platform/shared/common/ThreadQueue.cpp +31 -4
- data/platform/shared/common/ThreadQueue.h +10 -3
- data/platform/shared/common/Tokenizer.cpp +12 -8
- data/platform/shared/common/iphone/RhoClassFactory.cpp +5 -8
- data/platform/shared/common/iphone/RhoClassfactory.h +1 -1
- data/platform/shared/common/map/ESRIMapEngine.cpp +17 -7
- data/platform/shared/common/map/ESRIMapEngine.h +11 -1
- data/platform/shared/common/map/GoogleMapEngine.cpp +3 -3
- data/platform/shared/common/map/GoogleMapEngine.h +2 -2
- data/platform/shared/common/map/MapEngine.cpp +37 -0
- data/platform/shared/common/map/MapEngine.h +5 -0
- data/platform/shared/db/DBAdapter.cpp +113 -81
- data/platform/shared/db/DBAdapter.h +21 -5
- data/platform/shared/db/DBAttrManager.cpp +2 -2
- data/platform/shared/db/DBResult.h +28 -0
- data/platform/shared/net/AsyncHttp.cpp +48 -48
- data/platform/shared/net/AsyncHttp.h +15 -12
- data/platform/shared/net/CURLNetRequest.cpp +27 -105
- data/platform/shared/net/CURLNetRequest.h +8 -15
- data/platform/shared/net/INetRequest.cpp +122 -0
- data/platform/shared/net/INetRequest.h +96 -23
- data/platform/shared/net/ssl.cpp +1 -1
- data/platform/shared/ruby/ext/calendar/calendar.i +2 -2
- data/platform/shared/ruby/ext/calendar/calendar_wrap.c +30 -3
- data/platform/shared/rubyext/GeoLocation.cpp +4 -5
- data/platform/shared/rubyext/GeoLocation.h +4 -4
- data/platform/shared/rubyext/RhoAppAdapter.cpp +1 -1
- data/platform/shared/rubyext/System.cpp +3 -0
- data/platform/shared/sync/ClientRegister.cpp +6 -9
- data/platform/shared/sync/ClientRegister.h +8 -6
- data/platform/shared/sync/SyncEngine.cpp +54 -30
- data/platform/shared/sync/SyncEngine.h +9 -11
- data/platform/shared/sync/SyncNotify.cpp +19 -14
- data/platform/shared/sync/SyncNotify.h +5 -12
- data/platform/shared/sync/SyncSource.cpp +53 -76
- data/platform/shared/sync/SyncSource.h +5 -4
- data/platform/shared/sync/SyncThread.cpp +5 -7
- data/platform/shared/sync/SyncThread.h +2 -2
- data/platform/wm/RhoLib/RhoLib.vcproj +43 -39
- data/platform/wm/build/wm.rake +19 -17
- data/platform/wm/rhodes/AppManager.cpp +4 -4
- data/platform/wm/rhodes/MainWindow.cpp +0 -1
- data/platform/wm/rhodes/MapView/MapViewManager.cpp +4 -0
- data/platform/wm/rhodes/Vibrate.cpp +2 -2
- data/platform/wm/rhodes/Vibrate.h +1 -1
- data/platform/wm/rhodes/rho/common/RhoClassFactory.cpp +7 -5
- data/platform/wm/rhodes/rho/common/RhoClassFactory.h +3 -3
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +24 -10
- data/platform/wm/rhodes/rho/net/NetRequestImpl.h +49 -25
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +16 -2
- data/platform/wm/rhodes/rhodes.vcproj +77 -85
- data/platform/wm/tools/detool/detool.cpp +16 -6
- data/rakefile.rb +9 -5
- data/res/build-tools/detool.exe +0 -0
- data/rhodes.gemspec +2 -2
- data/spec/phone_spec/app/spec/blobsync_spec.rb +1 -0
- data/spec/phone_spec/app/spec/events_spec.rb +13 -2
- data/spec/phone_spec/app/spec/mapview_spec.rb +2 -2
- data/spec/phone_spec/app/spec/nativebar_spec.rb +3 -3
- data/spec/phone_spec/app/spec/navbar_spec.rb +3 -3
- data/spec/phone_spec/app/spec/rho_spec.rb +1 -1
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +1 -1
- data/spec/phone_spec/app/spec/syncengine_spec.rb +219 -0
- data/spec/phone_spec/build.yml +1 -0
- metadata +15 -8
- data/platform/wm/rhodes/rho/net/NetRequest.cpp +0 -89
- data/platform/wm/rhodes/rho/net/NetRequest.h +0 -45
@@ -3,8 +3,13 @@
|
|
3
3
|
#include "common/RhoStd.h"
|
4
4
|
#include "common/InputStream.h"
|
5
5
|
#include "common/AutoPointer.h"
|
6
|
+
#include "common/RhoMutexLock.h"
|
6
7
|
|
7
8
|
namespace rho {
|
9
|
+
namespace common {
|
10
|
+
class CRhoFile;
|
11
|
+
}
|
12
|
+
|
8
13
|
namespace net {
|
9
14
|
|
10
15
|
struct INetResponse
|
@@ -13,11 +18,9 @@ struct INetResponse
|
|
13
18
|
virtual const char* getCharData() = 0;
|
14
19
|
virtual unsigned int getDataSize() = 0;
|
15
20
|
virtual int getRespCode() = 0;
|
16
|
-
virtual boolean isOK() = 0;
|
17
|
-
virtual boolean isResponseRecieved() = 0;
|
18
|
-
virtual boolean isUnathorized() = 0;
|
19
|
-
virtual boolean isSuccess() = 0;
|
20
21
|
virtual String getCookies() = 0;
|
22
|
+
|
23
|
+
virtual void setCharData(const char* szData) = 0;
|
21
24
|
};
|
22
25
|
|
23
26
|
struct IRhoSession
|
@@ -39,34 +42,104 @@ struct CMultipartItem
|
|
39
42
|
String m_strDataPrefix;
|
40
43
|
};
|
41
44
|
|
42
|
-
struct
|
45
|
+
struct INetRequestImpl
|
43
46
|
{
|
44
|
-
virtual ~
|
47
|
+
virtual ~INetRequestImpl(void){;}
|
45
48
|
|
46
|
-
virtual INetResponse*
|
47
|
-
virtual INetResponse*
|
49
|
+
virtual INetResponse* doRequest( const char* method, const String& strUrl, const String& strBody, IRhoSession* oSession, Hashtable<String,String>* pHeaders )=0;
|
50
|
+
virtual INetResponse* pullFile(const String& strUrl, common::CRhoFile& oFile, IRhoSession* oSession, Hashtable<String,String>* pHeaders)=0;
|
48
51
|
virtual INetResponse* pushMultipartData(const String& strUrl, VectorPtr<CMultipartItem*>& arItems, IRhoSession* oSession, Hashtable<String,String>* pHeaders)=0;
|
49
|
-
virtual INetResponse* pushMultipartData(const String& strUrl, CMultipartItem& oItem, IRhoSession* oSession, Hashtable<String,String>* pHeaders)=0;
|
50
52
|
|
51
|
-
virtual
|
52
|
-
virtual INetResponse* pullCookies(const String& strUrl, const String& strBody, IRhoSession* oSession)=0;
|
53
|
+
virtual void cancel() = 0;
|
53
54
|
|
54
|
-
virtual
|
55
|
+
virtual boolean getSslVerifyPeer() = 0;
|
56
|
+
virtual void setSslVerifyPeer(boolean mode) = 0;
|
55
57
|
|
56
|
-
virtual
|
57
|
-
|
58
|
-
|
59
|
-
virtual String resolveUrl(const String& strUrl)=0;
|
58
|
+
virtual INetResponse* createEmptyNetResponse() = 0;
|
59
|
+
};
|
60
60
|
|
61
|
-
|
62
|
-
|
61
|
+
typedef rho::common::CAutoPtr<rho::net::INetResponse> NetResponsePtr;
|
62
|
+
|
63
|
+
class CNetResponseWrapper
|
64
|
+
{
|
65
|
+
NetResponsePtr m_netResp;
|
66
|
+
public:
|
67
|
+
CNetResponseWrapper( INetResponse* resp = 0) : m_netResp(resp) {}
|
68
|
+
|
69
|
+
const char* getCharData(){ return m_netResp->getCharData(); }
|
70
|
+
unsigned int getDataSize(){ return m_netResp->getDataSize(); }
|
71
|
+
int getRespCode(){ return m_netResp->getRespCode(); }
|
72
|
+
String getCookies(){ return m_netResp->getCookies(); }
|
73
|
+
|
74
|
+
boolean isOK()
|
75
|
+
{
|
76
|
+
return getRespCode() == 200 || getRespCode() == 206;
|
77
|
+
}
|
78
|
+
|
79
|
+
boolean isUnathorized()
|
80
|
+
{
|
81
|
+
return getRespCode() == 401;
|
82
|
+
}
|
83
|
+
|
84
|
+
boolean isRedirect()
|
85
|
+
{
|
86
|
+
return getRespCode() == 301 || getRespCode() ==302;
|
87
|
+
}
|
88
|
+
|
89
|
+
boolean isSuccess()
|
90
|
+
{
|
91
|
+
return getRespCode() > 0 && getRespCode() < 400;
|
92
|
+
}
|
93
|
+
|
94
|
+
boolean isResponseRecieved(){ return getRespCode() != -1; }
|
63
95
|
};
|
64
96
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
97
|
+
class CNetRequestHolder
|
98
|
+
{
|
99
|
+
common::CMutex m_mxReq;
|
100
|
+
INetRequestImpl* m_pReq;
|
101
|
+
boolean m_bCancel;
|
102
|
+
boolean m_sslVerifyPeer;
|
103
|
+
|
104
|
+
public:
|
105
|
+
|
106
|
+
CNetRequestHolder() : m_pReq(0), m_bCancel(false), m_sslVerifyPeer(true){}
|
107
|
+
|
108
|
+
void setRequest(INetRequestImpl* pReq);
|
109
|
+
void cancel();
|
110
|
+
boolean isCancelled();
|
111
|
+
static String resolveUrl(const String& strUrl);
|
112
|
+
|
113
|
+
boolean getSslVerifyPeer() {return m_sslVerifyPeer;}
|
114
|
+
void setSslVerifyPeer(boolean mode) {m_sslVerifyPeer = mode;}
|
115
|
+
};
|
116
|
+
|
117
|
+
class CNetRequestWrapper
|
118
|
+
{
|
119
|
+
common::CAutoPtr<INetRequestImpl> m_pReqImpl;
|
120
|
+
CNetRequestHolder* m_pHolder;
|
121
|
+
public:
|
122
|
+
CNetRequestWrapper(INetRequestImpl* pImpl, CNetRequestHolder* pHolder);
|
123
|
+
~CNetRequestWrapper();
|
124
|
+
|
125
|
+
INetResponse* pullData(const String& strUrl, IRhoSession* oSession );
|
126
|
+
INetResponse* pushData(const String& strUrl, const String& strBody, IRhoSession* oSession);
|
127
|
+
INetResponse* pullCookies(const String& strUrl, const String& strBody, IRhoSession* oSession);
|
128
|
+
INetResponse* doRequest( const char* method, const String& strUrl, const String& strBody, IRhoSession* oSession, Hashtable<String,String>* pHeaders );
|
129
|
+
INetResponse* pushMultipartData(const String& strUrl, VectorPtr<CMultipartItem*>& arItems, IRhoSession* oSession, Hashtable<String,String>* pHeaders);
|
130
|
+
INetResponse* pushMultipartData(const String& strUrl, CMultipartItem& oItem, IRhoSession* oSession, Hashtable<String,String>* pHeaders);
|
131
|
+
INetResponse* pullFile(const String& strUrl, const String& strFilePath, IRhoSession* oSession, Hashtable<String,String>* pHeaders);
|
132
|
+
|
133
|
+
String resolveUrl(const String& strUrl);
|
134
|
+
|
135
|
+
};
|
70
136
|
|
71
137
|
}
|
72
138
|
}
|
139
|
+
|
140
|
+
typedef rho::net::CNetResponseWrapper NetResponse;
|
141
|
+
typedef rho::net::CNetRequestHolder NetRequest;
|
142
|
+
|
143
|
+
rho::net::CNetRequestWrapper getNetRequest(rho::net::CNetRequestHolder* pHolder = 0);
|
144
|
+
|
145
|
+
|
data/platform/shared/net/ssl.cpp
CHANGED
@@ -6,7 +6,7 @@ extern VALUE event_fetch(VALUE params);
|
|
6
6
|
#define fetch event_fetch
|
7
7
|
extern VALUE event_fetch_by_id(const char *id);
|
8
8
|
#define fetch_by_id event_fetch_by_id
|
9
|
-
extern
|
9
|
+
extern const char* event_save(VALUE event);
|
10
10
|
#define save event_save
|
11
11
|
extern void event_delete(const char *id);
|
12
12
|
#define delete event_delete
|
@@ -22,7 +22,7 @@ extern VALUE fetch_by_id(const char *id);
|
|
22
22
|
%typemap(check) VALUE {
|
23
23
|
Check_Type($1, T_HASH);
|
24
24
|
}
|
25
|
-
extern
|
25
|
+
extern const char* save(VALUE event);
|
26
26
|
|
27
27
|
extern void delete(const char *id);
|
28
28
|
|
@@ -1820,7 +1820,7 @@ extern VALUE event_fetch(VALUE params);
|
|
1820
1820
|
#define fetch event_fetch
|
1821
1821
|
extern VALUE event_fetch_by_id(const char *id);
|
1822
1822
|
#define fetch_by_id event_fetch_by_id
|
1823
|
-
extern
|
1823
|
+
extern const char* event_save(VALUE event);
|
1824
1824
|
#define save event_save
|
1825
1825
|
extern void event_delete(const char *id);
|
1826
1826
|
#define delete event_delete
|
@@ -1879,6 +1879,30 @@ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
|
|
1879
1879
|
|
1880
1880
|
|
1881
1881
|
|
1882
|
+
|
1883
|
+
SWIGINTERNINLINE VALUE
|
1884
|
+
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
|
1885
|
+
{
|
1886
|
+
if (carray) {
|
1887
|
+
if (size > LONG_MAX) {
|
1888
|
+
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
|
1889
|
+
return pchar_descriptor ?
|
1890
|
+
SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : Qnil;
|
1891
|
+
} else {
|
1892
|
+
return rb_str_new(carray, (long)(size));
|
1893
|
+
}
|
1894
|
+
} else {
|
1895
|
+
return Qnil;
|
1896
|
+
}
|
1897
|
+
}
|
1898
|
+
|
1899
|
+
|
1900
|
+
SWIGINTERNINLINE VALUE
|
1901
|
+
SWIG_FromCharPtr(const char *cptr)
|
1902
|
+
{
|
1903
|
+
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
|
1904
|
+
}
|
1905
|
+
|
1882
1906
|
SWIGINTERN VALUE
|
1883
1907
|
_wrap_fetch(int argc, VALUE *argv, VALUE self) {
|
1884
1908
|
VALUE arg1 = (VALUE) 0 ;
|
@@ -1930,6 +1954,8 @@ fail:
|
|
1930
1954
|
SWIGINTERN VALUE
|
1931
1955
|
_wrap_save(int argc, VALUE *argv, VALUE self) {
|
1932
1956
|
VALUE arg1 = (VALUE) 0 ;
|
1957
|
+
char *result = 0 ;
|
1958
|
+
VALUE vresult = Qnil;
|
1933
1959
|
|
1934
1960
|
if ((argc < 1) || (argc > 1)) {
|
1935
1961
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
|
@@ -1938,8 +1964,9 @@ _wrap_save(int argc, VALUE *argv, VALUE self) {
|
|
1938
1964
|
{
|
1939
1965
|
Check_Type(arg1, T_HASH);
|
1940
1966
|
}
|
1941
|
-
save(arg1);
|
1942
|
-
|
1967
|
+
result = (char *)save(arg1);
|
1968
|
+
vresult = SWIG_FromCharPtr((const char *)result);
|
1969
|
+
return vresult;
|
1943
1970
|
fail:
|
1944
1971
|
return Qnil;
|
1945
1972
|
}
|
@@ -21,12 +21,12 @@ namespace rubyext{
|
|
21
21
|
IMPLEMENT_LOGCLASS(CGeoLocation,"GeoLocation");
|
22
22
|
CGeoLocation* CGeoLocation::m_pInstance = 0;
|
23
23
|
|
24
|
-
/*static*/ CGeoLocation* CGeoLocation::Create(
|
24
|
+
/*static*/ CGeoLocation* CGeoLocation::Create()
|
25
25
|
{
|
26
26
|
if ( m_pInstance )
|
27
27
|
return m_pInstance;
|
28
28
|
|
29
|
-
m_pInstance = new CGeoLocation(
|
29
|
+
m_pInstance = new CGeoLocation();
|
30
30
|
return m_pInstance;
|
31
31
|
}
|
32
32
|
|
@@ -38,10 +38,9 @@ CGeoLocation* CGeoLocation::m_pInstance = 0;
|
|
38
38
|
m_pInstance = 0;
|
39
39
|
}
|
40
40
|
|
41
|
-
CGeoLocation::CGeoLocation(
|
41
|
+
CGeoLocation::CGeoLocation()
|
42
42
|
{
|
43
43
|
m_nGeoPingTimeoutSec = 0;
|
44
|
-
m_NetRequest = pFactory->createNetRequest();
|
45
44
|
}
|
46
45
|
|
47
46
|
void CGeoLocation::callGeoCallback(const CGeoNotification& oNotify, boolean bError, boolean bRunInThread)
|
@@ -68,7 +67,7 @@ void CGeoLocation::callGeoCallback(const CGeoNotification& oNotify, boolean bErr
|
|
68
67
|
RHODESAPP().runCallbackInThread(strFullUrl, strBody);
|
69
68
|
else
|
70
69
|
{
|
71
|
-
|
70
|
+
getNet().pushData( strFullUrl, strBody, null );
|
72
71
|
}
|
73
72
|
}
|
74
73
|
|
@@ -16,7 +16,7 @@ public:
|
|
16
16
|
DEFINE_LOGCLASS;
|
17
17
|
private:
|
18
18
|
|
19
|
-
|
19
|
+
NetRequest m_NetRequest;
|
20
20
|
int m_nGeoPingTimeoutSec;
|
21
21
|
|
22
22
|
struct CGeoNotification
|
@@ -35,11 +35,11 @@ private:
|
|
35
35
|
|
36
36
|
static CGeoLocation* m_pInstance;
|
37
37
|
|
38
|
-
CGeoLocation(
|
38
|
+
CGeoLocation();
|
39
39
|
|
40
40
|
public:
|
41
41
|
|
42
|
-
static CGeoLocation* Create(
|
42
|
+
static CGeoLocation* Create();
|
43
43
|
static void Destroy();
|
44
44
|
static CGeoLocation* getInstance(){ return m_pInstance; }
|
45
45
|
|
@@ -55,7 +55,7 @@ private:
|
|
55
55
|
void setPingTimeoutSec( int nTimeout );
|
56
56
|
void callGeoCallback(const CGeoNotification& oNotify, boolean bError, boolean bRunInThread);
|
57
57
|
|
58
|
-
net::
|
58
|
+
net::CNetRequestWrapper getNet(){ return getNetRequest(&m_NetRequest); }
|
59
59
|
};
|
60
60
|
|
61
61
|
}
|
@@ -21,7 +21,7 @@ const _CRhoAppAdapter& RhoAppAdapter = _CRhoAppAdapter();
|
|
21
21
|
return rho_ruby_getErrorText(nError);
|
22
22
|
}
|
23
23
|
|
24
|
-
/*static*/ int _CRhoAppAdapter::getErrorFromResponse(
|
24
|
+
/*static*/ int _CRhoAppAdapter::getErrorFromResponse(NetResponse& resp)
|
25
25
|
{
|
26
26
|
if ( !resp.isResponseRecieved())
|
27
27
|
return ERR_NETWORK;
|
@@ -59,6 +59,9 @@ VALUE rho_sys_get_property(char* szPropName)
|
|
59
59
|
if (strcasecmp("has_touchscreen",szPropName) == 0)
|
60
60
|
return rho_ruby_create_boolean(1);
|
61
61
|
|
62
|
+
if (strcasecmp("has_sqlite",szPropName) == 0)
|
63
|
+
return rho_ruby_create_boolean(1);
|
64
|
+
|
62
65
|
RAWLOG_ERROR1("Unknown Rho::System property : %s", szPropName);
|
63
66
|
|
64
67
|
return rho_ruby_get_NIL();
|
@@ -15,12 +15,12 @@ IMPLEMENT_LOGCLASS(CClientRegister,"ClientRegister");
|
|
15
15
|
|
16
16
|
CClientRegister* CClientRegister::m_pInstance = 0;
|
17
17
|
|
18
|
-
/*static*/ CClientRegister* CClientRegister::Create(
|
18
|
+
/*static*/ CClientRegister* CClientRegister::Create(const char* device_pin)
|
19
19
|
{
|
20
20
|
if ( m_pInstance )
|
21
21
|
return m_pInstance;
|
22
22
|
|
23
|
-
m_pInstance = new CClientRegister(
|
23
|
+
m_pInstance = new CClientRegister(device_pin);
|
24
24
|
return m_pInstance;
|
25
25
|
}
|
26
26
|
|
@@ -32,20 +32,17 @@ CClientRegister* CClientRegister::m_pInstance = 0;
|
|
32
32
|
m_pInstance = 0;
|
33
33
|
}
|
34
34
|
|
35
|
-
CClientRegister::CClientRegister(
|
35
|
+
CClientRegister::CClientRegister(const char* device_pin) : CRhoThread()
|
36
36
|
{
|
37
37
|
m_strDevicePin = device_pin;
|
38
|
-
m_NetRequest = factory->createNetRequest();
|
39
38
|
m_nPollInterval = POLL_INTERVAL_SECONDS;
|
40
39
|
|
41
|
-
delete factory;
|
42
|
-
|
43
40
|
startUp();
|
44
41
|
}
|
45
42
|
|
46
43
|
CClientRegister::~CClientRegister()
|
47
44
|
{
|
48
|
-
m_NetRequest
|
45
|
+
m_NetRequest.cancel();
|
49
46
|
|
50
47
|
stop(WAIT_BEFOREKILL_SECONDS);
|
51
48
|
m_pInstance = null;
|
@@ -99,7 +96,7 @@ boolean CClientRegister::doRegister(CSyncEngine& oSync)
|
|
99
96
|
if ( client_id.length() == 0 )
|
100
97
|
return false;
|
101
98
|
|
102
|
-
|
99
|
+
IDBResult res = CDBAdapter::getUserDB().executeSQL("SELECT token,token_sent from client_info");
|
103
100
|
if ( !res.isEnd() ) {
|
104
101
|
String token = res.getStringByIdx(0);
|
105
102
|
int token_sent = res.getIntByIdx(1);
|
@@ -111,7 +108,7 @@ boolean CClientRegister::doRegister(CSyncEngine& oSync)
|
|
111
108
|
}
|
112
109
|
}
|
113
110
|
String strBody = getRegisterBody(client_id);
|
114
|
-
NetResponse
|
111
|
+
NetResponse resp = getNet().pushData( oSync.getProtocol().getClientRegisterUrl(), strBody, &oSync );
|
115
112
|
if( resp.isOK() )
|
116
113
|
{
|
117
114
|
// try {
|
@@ -21,11 +21,11 @@ class CClientRegister : public common::CRhoThread
|
|
21
21
|
DEFINE_LOGCLASS;
|
22
22
|
|
23
23
|
static CClientRegister* m_pInstance;
|
24
|
-
|
25
|
-
String
|
26
|
-
unsigned int
|
24
|
+
NetRequest m_NetRequest;
|
25
|
+
String m_strDevicePin;
|
26
|
+
unsigned int m_nPollInterval;
|
27
27
|
public:
|
28
|
-
static CClientRegister* Create(
|
28
|
+
static CClientRegister* Create(const char* device_pin);
|
29
29
|
static void Destroy();
|
30
30
|
static CClientRegister* getInstance() { return m_pInstance; }
|
31
31
|
|
@@ -36,12 +36,14 @@ public:
|
|
36
36
|
String getRegisterBody(const String& strClientID);
|
37
37
|
|
38
38
|
void startUp();
|
39
|
+
|
40
|
+
void setSslVerifyPeer(boolean b){m_NetRequest.setSslVerifyPeer(b);}
|
39
41
|
private:
|
40
|
-
CClientRegister(
|
42
|
+
CClientRegister(const char* device_pin);
|
41
43
|
~CClientRegister();
|
42
44
|
|
43
45
|
boolean doRegister(CSyncEngine& oSync);
|
44
|
-
net::
|
46
|
+
net::CNetRequestWrapper getNet(){ return getNetRequest(&m_NetRequest); }
|
45
47
|
|
46
48
|
};
|
47
49
|
|