rhodes 2.1.0 → 2.2.0.beta.1
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/README.textile +4 -5
- data/Rakefile +8 -1
- data/lib/build/jake.rb +22 -16
- data/lib/extensions/rhoxml/rexml/cdata.rb +67 -0
- data/lib/extensions/rhoxml/rexml/document.rb +2 -116
- data/lib/extensions/rhoxml/rexml/element.rb +1 -1
- data/lib/extensions/rhoxml/rexml/text.rb +117 -0
- data/lib/framework/rho/render.rb +19 -11
- data/lib/framework/rho/rho.rb +17 -10
- data/lib/framework/rho/rhobluetooth.rb +103 -0
- data/lib/framework/rho/rhocontroller.rb +2 -0
- data/lib/framework/rho/rhoevent.rb +43 -0
- data/lib/framework/rho/rhoevent_bb.rb +80 -0
- data/lib/framework/rho/rhoevent_c.rb +47 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom_db_adapter.rb +2 -1
- data/lib/framework/rhom/rhom_model.rb +9 -3
- data/lib/framework/rhom/rhom_object_factory.rb +46 -22
- data/lib/framework/rhom/rhom_source.rb +12 -10
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +23 -2
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +54 -38
- data/platform/android/Rhodes/jni/include/rhodes.h +3 -0
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +2 -2
- data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +4 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +16 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_bluetooth_RhoBluetoothManager.h +21 -0
- data/platform/android/Rhodes/jni/src/bluetooth.cpp +169 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +10 -0
- data/platform/android/Rhodes/jni/src/event.cpp +429 -0
- data/platform/android/Rhodes/jni/src/fileapi.cpp +51 -1
- data/platform/android/Rhodes/jni/src/rhodes.cpp +16 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -0
- data/platform/android/Rhodes/res/layout/bt_device_list.xml +42 -0
- data/platform/android/Rhodes/res/layout/bt_device_name.xml +7 -0
- data/platform/android/Rhodes/res/values/strings.xml +8 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +14 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +2 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Push.java +7 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +58 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +53 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +8 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +144 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/IRhoBluetoothManager.java +66 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothDeviceListActivity.java +201 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +139 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java +401 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerOld.java +136 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothSession.java +457 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/UUIDHelper.java +71 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +12 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/Event.java +19 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +261 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +4 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +10 -2
- data/platform/android/build/RhodesSRC_build.files +33 -22
- data/platform/android/build/android.rake +198 -27
- data/platform/android/build/librhodes_build.files +3 -1
- data/platform/android/build/libruby_build.files +4 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +2 -2
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBRowResult.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +7 -4
- data/platform/bb/Hsqldb/src/org/hsqldb/Like.java +3 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/Table.java +3 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +1 -1
- data/platform/bb/RubyVM/RubyVM.jdp +1 -0
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +108 -1
- data/platform/bb/RubyVM/src/com/rho/RhoLogConf.java +7 -1
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +7 -4
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +7 -1
- data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +21 -23
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +19 -10
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +8 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +3 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +14 -17
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFile.java +7 -5
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +2 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyRuntime.java +10 -1
- data/platform/bb/RubyVM/src/j2me/io/File.java +7 -6
- data/platform/bb/build/RubyVM_build.files +412 -412
- data/platform/bb/build/bb.rake +42 -18
- data/platform/bb/build/hsqldb_build.files +151 -151
- data/platform/bb/build/rhodes_build.files +44 -40
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +2 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +237 -0
- data/platform/bb/rhodes/platform/common/com/rho/RhodesApplicationPlatform.java +14 -0
- data/platform/bb/rhodes/rhodes.jdp +6 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +7 -1
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +14 -0
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +62 -76
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +660 -0
- data/platform/bb/rhodes/src/{rhomobile → com/rho/rubyext}/RhoPhonebook.java +95 -38
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +22 -1
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +26 -6
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +21 -7
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothManager.java +528 -0
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothPort.java +281 -0
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothScreen.java +119 -0
- data/platform/bb/rhodes/src/rhomobile/camera/CameraFilesListener.java +2 -2
- data/platform/iphone/Classes/AppManager/AppManager.m +70 -7
- data/platform/iphone/Classes/Bluetooth/Bluetooth.h +72 -0
- data/platform/iphone/Classes/Bluetooth/Bluetooth.m +414 -0
- data/platform/iphone/Classes/Event/Event.h +12 -0
- data/platform/iphone/Classes/Event/Event.m +300 -0
- data/platform/iphone/Classes/LogOptionsController.h +2 -1
- data/platform/iphone/Classes/LogOptionsController.m +1 -1
- data/platform/iphone/Classes/LogViewController.h +2 -1
- data/platform/iphone/Classes/MapView/MapViewController.h +2 -1
- data/platform/iphone/Classes/RhoViewController.h +16 -0
- data/platform/iphone/Classes/RhoViewController.m +20 -0
- data/platform/iphone/Classes/Rhodes.h +12 -0
- data/platform/iphone/Classes/Rhodes.m +34 -6
- data/platform/iphone/Classes/Signature/SignatureViewController.h +2 -2
- data/platform/iphone/Classes/Signature/SignatureViewController.m +0 -10
- data/platform/iphone/Classes/SimpleMainView.h +2 -2
- data/platform/iphone/Classes/SimpleMainView.m +5 -14
- data/platform/iphone/Classes/SplashViewController.h +2 -2
- data/platform/iphone/Classes/TabbedMainView.h +2 -2
- data/platform/iphone/Classes/TabbedMainView.m +5 -10
- data/platform/iphone/Info.plist +5 -5
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +39 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +47 -4
- data/platform/osx/Rhodes Debugger/NoodleLineNumberView.m +3 -2
- data/platform/shared/common/AutoPointer.h +3 -0
- data/platform/shared/common/RhoConf.cpp +2 -1
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhoTime.h +3 -3
- data/platform/shared/common/RhodesApp.cpp +75 -23
- data/platform/shared/common/RhodesApp.h +4 -0
- data/platform/shared/common/RhodesAppBase.h +2 -0
- data/platform/shared/common/ThreadQueue.cpp +23 -18
- data/platform/shared/common/ThreadQueue.h +2 -0
- data/platform/shared/db/res/db/syncdb.schema +39 -39
- data/platform/shared/logging/RhoLogConf.cpp +58 -3
- data/platform/shared/logging/RhoLogConf.h +3 -1
- data/platform/shared/net/CURLNetRequest.cpp +17 -6
- data/platform/shared/net/HttpServer.cpp +125 -25
- data/platform/shared/net/HttpServer.h +4 -3
- data/platform/shared/ruby/ext/bluetooth/bluetooth.i +56 -0
- data/platform/shared/ruby/ext/bluetooth/bluetooth_wrap.c +2563 -0
- data/platform/shared/ruby/ext/calendar/calendar.i +28 -0
- data/platform/shared/ruby/ext/calendar/calendar_wrap.c +2251 -0
- data/platform/shared/ruby/ext/calendar/event.h +41 -0
- data/platform/shared/ruby/ext/calendar/event.i +28 -0
- data/platform/shared/ruby/ext/calendar/event_wrap.c +2151 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +103 -3
- data/platform/shared/ruby/ext/rho/rhoruby.h +16 -2
- data/platform/shared/ruby/ext/rhoconf/rhoconf.i +12 -0
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +101 -0
- data/platform/shared/ruby/ext/system/system.i +14 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +2568 -2208
- data/platform/shared/ruby/main.c +8 -0
- data/platform/shared/rubyext/GeoLocation.cpp +6 -3
- data/platform/shared/rubyext/System.cpp +14 -0
- data/platform/shared/sync/SyncEngine.cpp +9 -1
- data/platform/shared/sync/SyncNotify.cpp +16 -8
- data/platform/shared/sync/SyncNotify.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +7 -12
- data/platform/shared/sync/SyncThread.h +5 -3
- data/platform/wm/build/wm.rake +7 -1
- data/platform/wm/rhodes/Alert.cpp +1 -1
- data/platform/wm/rhodes/MainWindow.cpp +28 -0
- data/platform/wm/rhodes/MainWindow.h +9 -0
- data/platform/wm/rhodes/OutlookApp.cpp +72 -0
- data/platform/wm/rhodes/OutlookApp.h +22 -0
- data/platform/wm/rhodes/Rhodes.cpp +8 -0
- data/platform/wm/rhodes/Rhodes.rc +31 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +1274 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.h +321 -0
- data/platform/wm/rhodes/phonebook/NativeAddressBook.cpp +37 -70
- data/platform/wm/rhodes/phonebook/NativeAddressBook.h +0 -4
- data/platform/wm/rhodes/resource.h +8 -1
- data/platform/wm/rhodes/rho/net/NetRequest.cpp +4 -0
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +6 -4
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +487 -0
- data/platform/wm/rhodes/rhodes.vcproj +28 -11
- data/platform/wm/rhodes/stdafx.h +1 -0
- data/platform/wm/rubylib/rubylib.vcproj +32 -0
- data/rakefile.rb +8 -1
- data/res/generators/templates/application/Rakefile +1 -1
- data/res/generators/templates/application/app/layout.erb +4 -1
- data/res/generators/templates/application/build.yml +0 -1
- data/res/generators/templates/application/public/css/iphone.css +2 -2
- data/res/generators/templates/application/public/jqtouch/jqtouch-iphone.css +9 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.css +1 -5
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +3 -2
- data/rhodes.gemspec +1 -1
- data/spec/perfomance_spec/app/Benchmark/benchmark.rb +4 -0
- data/spec/perfomance_spec/app/Benchmark/bulk_results.erb +13 -0
- data/spec/perfomance_spec/app/Benchmark/controller.rb +178 -0
- data/spec/perfomance_spec/app/Benchmark/create_results.erb +13 -0
- data/spec/perfomance_spec/app/Benchmark/customers.erb +35 -0
- data/spec/perfomance_spec/app/Benchmark/index.erb +9 -0
- data/spec/perfomance_spec/app/Benchmark/products.erb +25 -0
- data/spec/perfomance_spec/app/Benchmark/search_results.erb +13 -0
- data/spec/perfomance_spec/app/Customer/customer.rb +6 -0
- data/spec/perfomance_spec/app/Perftest/index.erb +5 -0
- data/spec/perfomance_spec/app/Product/index.erb +25 -0
- data/spec/perfomance_spec/app/Product/product.rb +6 -0
- data/spec/perfomance_spec/app/helpers/application_helper.rb +126 -0
- data/spec/perfomance_spec/app/helpers/browser_helper.rb +18 -0
- data/spec/perfomance_spec/rhoconfig.txt +1 -1
- data/spec/phone_spec/app/Account_s/account_s.rb +5 -2
- data/spec/phone_spec/app/Case/case.rb +1 -0
- data/spec/phone_spec/app/Case_s/case_s.rb +2 -0
- data/spec/phone_spec/app/Data/perftest.json +35 -0
- data/spec/phone_spec/app/Data/testCDATA.xml +11 -0
- data/spec/phone_spec/app/Product/product.rb +1 -1
- data/spec/phone_spec/app/{Spec → spec}/asynchttp_spec.rb +66 -17
- data/spec/phone_spec/app/{Spec → spec}/barcode_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/blobsync_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/bsearch_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/bulksync_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/contacts_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/crypt_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/date_spec.rb +0 -0
- data/spec/phone_spec/app/spec/events_spec.rb +199 -0
- data/spec/phone_spec/app/{Spec → spec}/fixtures/client_info.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/fixtures/object_values.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/json_spec.rb +11 -2
- data/spec/phone_spec/app/{Spec → spec}/mapview_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/nativebar_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/navbar_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/pagination/fixtures/object_values.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/rho_controller_spec.rb +5 -0
- data/spec/phone_spec/app/{Spec → spec}/rho_spec.rb +48 -0
- data/spec/phone_spec/app/{Spec → spec}/rhofile_spec.rb +9 -6
- data/spec/phone_spec/app/{Spec → spec}/rhom_object_spec.rb +188 -9
- data/spec/phone_spec/app/{Spec → spec}/syncengine_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/xml_spec.rb +15 -0
- data/spec/phone_spec/app/{Spec → spec}/xruby_spec.rb +0 -0
- data/spec/phone_spec/app/spec_runner.rb +4 -1
- data/spec/phone_spec/build.yml +2 -1
- metadata +95 -31
- data/platform/bb/rhodes/platform/5.0/com/rho/RhoMainScreen.java +0 -36
- data/platform/bb/rhodes/platform/6.0/com/rho/BrowserAdapter5.java +0 -155
- data/platform/bb/rhodes/platform/6.0/com/rho/RhoMainScreen.java +0 -36
@@ -55,9 +55,15 @@ module Rhom
|
|
55
55
|
|
56
56
|
def belongs_to(name, owner)
|
57
57
|
BaseModel.model_params ||= {}
|
58
|
-
BaseModel.model_params['belongs_to'] ||=
|
59
|
-
|
60
|
-
|
58
|
+
BaseModel.model_params['belongs_to'] ||= []
|
59
|
+
|
60
|
+
if owner.is_a?(Array)
|
61
|
+
owner.each do |src|
|
62
|
+
BaseModel.model_params['belongs_to'] << {name.to_s => src.to_s}
|
63
|
+
end
|
64
|
+
else
|
65
|
+
BaseModel.model_params['belongs_to'] << {name.to_s => owner.to_s}
|
66
|
+
end
|
61
67
|
end
|
62
68
|
|
63
69
|
def index(name,cols)
|
@@ -758,9 +758,9 @@ module Rhom
|
|
758
758
|
sql << ") WHERE " + condition_str if condition_str
|
759
759
|
sql << strLimit if strLimit
|
760
760
|
|
761
|
-
puts "Database query start"
|
761
|
+
#puts "Database query start"
|
762
762
|
list = db.execute_sql(sql)
|
763
|
-
puts "Database query end"
|
763
|
+
#puts "Database query end"
|
764
764
|
end
|
765
765
|
end
|
766
766
|
|
@@ -778,9 +778,9 @@ module Rhom
|
|
778
778
|
sql << " order by \"#{order_attr}\" " + order_dir if !block_given? && order_attr
|
779
779
|
sql << strLimit if strLimit
|
780
780
|
|
781
|
-
puts "Database query start" #: #{sql}"
|
781
|
+
#puts "Database query start" #: #{sql}"
|
782
782
|
list = db.execute_sql(sql)
|
783
|
-
puts "Database query end"
|
783
|
+
#puts "Database query end"
|
784
784
|
|
785
785
|
end
|
786
786
|
|
@@ -1122,14 +1122,21 @@ module Rhom
|
|
1122
1122
|
end
|
1123
1123
|
|
1124
1124
|
if resValue && resValue.length > 0
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
if
|
1129
|
-
isModified =
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1125
|
+
|
1126
|
+
isModified = false
|
1127
|
+
|
1128
|
+
if is_inst_full_update
|
1129
|
+
isModified = true
|
1130
|
+
else
|
1131
|
+
oldValue = isSchemaSrc ? resValue[0][key] : resValue[0]['value']
|
1132
|
+
|
1133
|
+
isModified = oldValue != val
|
1134
|
+
if isModified && val && oldValue.nil? && val.to_s().length == 0
|
1135
|
+
isModified = false
|
1136
|
+
end
|
1137
|
+
if isModified && oldValue && val.nil? && oldValue.to_s().length == 0
|
1138
|
+
isModified = false
|
1139
|
+
end
|
1133
1140
|
end
|
1134
1141
|
|
1135
1142
|
if isModified
|
@@ -1185,21 +1192,34 @@ module Rhom
|
|
1185
1192
|
tableName = is_inst_schema_source() ? get_inst_schema_table_name() : 'object_values'
|
1186
1193
|
begin
|
1187
1194
|
db.start_transaction
|
1195
|
+
|
1196
|
+
if is_inst_full_update
|
1197
|
+
attrs.each do |attrib,val|
|
1198
|
+
self.vars[attrib.to_sym()] = val
|
1199
|
+
end
|
1200
|
+
attrs = self.vars
|
1201
|
+
end
|
1202
|
+
|
1188
1203
|
attrs.each do |attrib,val|
|
1189
1204
|
attrib = attrib.to_s.gsub(/@/,"")
|
1190
1205
|
next if ::Rhom::RhomObject.method_name_reserved?(attrib)
|
1191
|
-
|
1192
|
-
old_val = self.send attrib.to_sym unless ::Rhom::RhomObject.method_name_reserved?(attrib)
|
1193
|
-
|
1206
|
+
|
1194
1207
|
# Don't save objects with braces to database
|
1195
1208
|
new_val = val.to_s #self.inst_strip_braces(val.to_s)
|
1209
|
+
isModified = false
|
1196
1210
|
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1211
|
+
if is_inst_full_update
|
1212
|
+
isModified = true
|
1213
|
+
else
|
1214
|
+
old_val = self.send attrib.to_sym unless ::Rhom::RhomObject.method_name_reserved?(attrib)
|
1215
|
+
|
1216
|
+
isModified = old_val != new_val
|
1217
|
+
if isModified && new_val && old_val.nil? && new_val.to_s().length == 0
|
1218
|
+
isModified = false
|
1219
|
+
end
|
1220
|
+
if isModified && old_val && new_val.nil? && old_val.to_s().length == 0
|
1221
|
+
isModified = false
|
1222
|
+
end
|
1203
1223
|
end
|
1204
1224
|
|
1205
1225
|
# if the object's value doesn't match the database record
|
@@ -1243,7 +1263,7 @@ module Rhom
|
|
1243
1263
|
end
|
1244
1264
|
|
1245
1265
|
# update in-memory object
|
1246
|
-
self.vars[attrib.to_sym()] = new_val
|
1266
|
+
self.vars[attrib.to_sym()] = new_val unless is_inst_full_update
|
1247
1267
|
end
|
1248
1268
|
end
|
1249
1269
|
|
@@ -1277,6 +1297,10 @@ module Rhom
|
|
1277
1297
|
def get_inst_schema_table_name
|
1278
1298
|
get_inst_source_name()
|
1279
1299
|
end
|
1300
|
+
|
1301
|
+
def is_inst_full_update
|
1302
|
+
Rho::RhoConfig.sources[get_inst_source_name]['full_update']
|
1303
|
+
end
|
1280
1304
|
|
1281
1305
|
def inst_strip_braces(str=nil)
|
1282
1306
|
str ? str.gsub(/\{/,"").gsub(/\}/,"") : nil
|
@@ -52,25 +52,27 @@ module Rhom
|
|
52
52
|
class << self
|
53
53
|
include ::Rhom::RhomObject
|
54
54
|
def find(*args)
|
55
|
-
|
56
|
-
|
55
|
+
if args.first == :all || args.first == :first
|
56
|
+
list = []
|
57
|
+
|
57
58
|
results = ::Rho::RHO.get_src_db().select_from_table('sources', '*')
|
58
59
|
|
59
60
|
results.each do |result|
|
60
61
|
list << RhomSource.new(result)
|
61
62
|
end
|
62
|
-
|
63
|
+
|
64
|
+
if args.first == :first
|
65
|
+
return list.length > 0 ? list[0] : nil
|
66
|
+
end
|
67
|
+
|
68
|
+
list
|
69
|
+
|
70
|
+
else
|
63
71
|
result = ::Rho::RHO.get_src_db().select_from_table('sources', '*',
|
64
72
|
{"source_id" => strip_braces(args.first)}).first
|
65
|
-
|
66
|
-
list << RhomSource.new(result)
|
73
|
+
RhomSource.new(result)
|
67
74
|
end
|
68
75
|
|
69
|
-
if args.first == :first
|
70
|
-
return list.length > 0 ? list[0] : nil
|
71
|
-
end
|
72
|
-
|
73
|
-
list
|
74
76
|
end
|
75
77
|
|
76
78
|
def find_all_ashash
|
data/lib/framework/version.rb
CHANGED
data/lib/rhodes.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
2
2
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
3
3
|
package="com.rhomobile.rhodes"
|
4
|
-
android:versionCode="
|
5
|
-
android:versionName="2.
|
4
|
+
android:versionCode="22"
|
5
|
+
android:versionName="2.2.0">
|
6
6
|
<uses-sdk android:minSdkVersion="3" />
|
7
7
|
<application android:icon="@drawable/icon"
|
8
8
|
android:multiprocess="true"
|
@@ -23,7 +23,20 @@
|
|
23
23
|
<activity android:name="com.rhomobile.rhodes.signature.ImageCapture" />
|
24
24
|
<activity android:name="com.rhomobile.rhodes.datetime.DateTimePickerScreen" />
|
25
25
|
<activity android:name="com.rhomobile.rhodes.mapview.MapView" />
|
26
|
+
<activity android:name="com.rhomobile.rhodes.bluetooth.RhoBluetoothDeviceListActivity" />
|
26
27
|
<uses-library android:name="com.google.android.maps" />
|
28
|
+
<receiver android:name="com.rhomobile.rhodes.PushReceiver" android:permission="com.google.android.c2dm.permission.SEND">
|
29
|
+
<!-- Receive the actual message -->
|
30
|
+
<intent-filter>
|
31
|
+
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
32
|
+
<category android:name="com.rhomobile.rhodes" />
|
33
|
+
</intent-filter>
|
34
|
+
<!-- Receive the registration id -->
|
35
|
+
<intent-filter>
|
36
|
+
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
37
|
+
<category android:name="com.rhomobile.rhodes" />
|
38
|
+
</intent-filter>
|
39
|
+
</receiver>
|
27
40
|
</application>
|
28
41
|
<uses-permission android:name="android.permission.INTERNET" />
|
29
42
|
<uses-permission android:name="android.permission.CAMERA" />
|
@@ -37,4 +50,12 @@
|
|
37
50
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
38
51
|
<uses-permission android:name="android.permission.VIBRATE" />
|
39
52
|
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
53
|
+
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
54
|
+
<uses-permission android:name="android.permission.BLUETOOTH" />
|
55
|
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
56
|
+
<uses-permission android:name="android.permission.READ_CALENDAR" />
|
57
|
+
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
|
58
|
+
<permission android:name="com.rhomobile.rhodes.permission.C2D_MESSAGE" android:protectionLevel="signature" />
|
59
|
+
<uses-permission android:name="com.rhomobile.rhodes.permission.C2D_MESSAGE" />
|
60
|
+
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
40
61
|
</manifest>
|
@@ -34,46 +34,53 @@ public final class R {
|
|
34
34
|
public static final int sync=0x7f020010;
|
35
35
|
}
|
36
36
|
public static final class id {
|
37
|
-
public static final int LinearLayout01=
|
38
|
-
public static final int buttonLayout=
|
39
|
-
public static final int
|
40
|
-
public static final int
|
41
|
-
public static final int
|
42
|
-
public static final int
|
43
|
-
public static final int
|
44
|
-
public static final int
|
45
|
-
public static final int
|
46
|
-
public static final int
|
47
|
-
public static final int
|
48
|
-
public static final int
|
49
|
-
public static final int
|
50
|
-
public static final int
|
51
|
-
public static final int
|
52
|
-
public static final int
|
53
|
-
public static final int
|
54
|
-
public static final int
|
55
|
-
public static final int
|
56
|
-
public static final int
|
57
|
-
public static final int
|
58
|
-
public static final int
|
59
|
-
public static final int
|
60
|
-
public static final int
|
61
|
-
public static final int
|
62
|
-
public static final int
|
63
|
-
public static final int
|
64
|
-
public static final int
|
65
|
-
public static final int
|
66
|
-
public static final int
|
37
|
+
public static final int LinearLayout01=0x7f07000a;
|
38
|
+
public static final int buttonLayout=0x7f070010;
|
39
|
+
public static final int button_scan=0x7f070004;
|
40
|
+
public static final int cameraButton=0x7f070006;
|
41
|
+
public static final int cancelButton=0x7f07000c;
|
42
|
+
public static final int datePicker=0x7f070008;
|
43
|
+
public static final int datetime=0x7f070007;
|
44
|
+
public static final int excludeClasses=0x7f070016;
|
45
|
+
public static final int filesList=0x7f070012;
|
46
|
+
public static final int includeClasses=0x7f070015;
|
47
|
+
public static final int logcontent=0x7f07001a;
|
48
|
+
public static final int loglevel=0x7f070014;
|
49
|
+
public static final int logoptsCloseButton=0x7f070018;
|
50
|
+
public static final int logoptsSaveButton=0x7f070017;
|
51
|
+
public static final int logviewClearButton=0x7f07001c;
|
52
|
+
public static final int logviewCloseButton=0x7f07001e;
|
53
|
+
public static final int logviewRefreshButton=0x7f07001b;
|
54
|
+
public static final int logviewSendButton=0x7f07001d;
|
55
|
+
public static final int lookIn=0x7f07000f;
|
56
|
+
public static final int new_devices=0x7f070003;
|
57
|
+
public static final int okButton=0x7f07000b;
|
58
|
+
public static final int paired_devices=0x7f070001;
|
59
|
+
public static final int preview=0x7f070011;
|
60
|
+
public static final int scrollview=0x7f070019;
|
61
|
+
public static final int sig_cancelButton=0x7f070020;
|
62
|
+
public static final int sig_clearButton=0x7f070021;
|
63
|
+
public static final int sig_okButton=0x7f070022;
|
64
|
+
public static final int signature_view=0x7f07001f;
|
65
|
+
public static final int surface=0x7f070005;
|
66
|
+
public static final int text=0x7f07000d;
|
67
|
+
public static final int text1=0x7f070013;
|
68
|
+
public static final int timePicker=0x7f070009;
|
69
|
+
public static final int title_new_devices=0x7f070002;
|
70
|
+
public static final int title_paired_devices=0x7f070000;
|
71
|
+
public static final int widget28=0x7f07000e;
|
67
72
|
}
|
68
73
|
public static final class layout {
|
69
|
-
public static final int
|
70
|
-
public static final int
|
71
|
-
public static final int
|
72
|
-
public static final int
|
73
|
-
public static final int
|
74
|
-
public static final int
|
75
|
-
public static final int
|
76
|
-
public static final int
|
74
|
+
public static final int bt_device_list=0x7f030000;
|
75
|
+
public static final int bt_device_name=0x7f030001;
|
76
|
+
public static final int camera=0x7f030002;
|
77
|
+
public static final int datetime=0x7f030003;
|
78
|
+
public static final int dialog_activity=0x7f030004;
|
79
|
+
public static final int directory_list=0x7f030005;
|
80
|
+
public static final int file_row=0x7f030006;
|
81
|
+
public static final int logoptions=0x7f030007;
|
82
|
+
public static final int logview=0x7f030008;
|
83
|
+
public static final int signature=0x7f030009;
|
77
84
|
}
|
78
85
|
public static final class menu {
|
79
86
|
public static final int options=0x7f060000;
|
@@ -83,6 +90,7 @@ public final class R {
|
|
83
90
|
public static final int about_rhodes=0x7f04000e;
|
84
91
|
public static final int app_name=0x7f040000;
|
85
92
|
public static final int back=0x7f040004;
|
93
|
+
public static final int button_scan=0x7f040017;
|
86
94
|
public static final int cancel=0x7f040010;
|
87
95
|
public static final int exit=0x7f040007;
|
88
96
|
public static final int forward=0x7f040003;
|
@@ -91,10 +99,18 @@ public final class R {
|
|
91
99
|
public static final int logview=0x7f04000a;
|
92
100
|
public static final int navigation=0x7f040005;
|
93
101
|
public static final int no_files=0x7f04000c;
|
102
|
+
public static final int none_found=0x7f040014;
|
103
|
+
public static final int none_paired=0x7f040013;
|
94
104
|
public static final int ok=0x7f04000f;
|
95
105
|
public static final int options=0x7f040009;
|
96
106
|
public static final int refresh=0x7f040002;
|
107
|
+
/** RhoBluetoothDeviceListActivity
|
108
|
+
*/
|
109
|
+
public static final int scanning=0x7f040011;
|
110
|
+
public static final int select_device=0x7f040012;
|
97
111
|
public static final int sync=0x7f040008;
|
112
|
+
public static final int title_other_devices=0x7f040016;
|
113
|
+
public static final int title_paired_devices=0x7f040015;
|
98
114
|
public static final int to_top=0x7f04000d;
|
99
115
|
}
|
100
116
|
}
|
@@ -39,8 +39,8 @@ VALUE convertJavaMapToRubyHash(jobject objMap);
|
|
39
39
|
|
40
40
|
#define RHO_NOT_IMPLEMENTED RAWLOG_ERROR3("WARNING: Call not implemented function: \"%s\" (defined here: %s:%d)", __PRETTY_FUNCTION__, __FILE__, __LINE__)
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
#define RHO_LOG_CALLBACK RAWLOG_INFO1("Callback \"%s\" called", __PRETTY_FUNCTION__)
|
43
|
+
#define RHO_LOG_JNI_CALL RAWLOG_INFO1("JNI method \"%s\" called", __PRETTY_FUNCTION__)
|
44
44
|
|
45
45
|
class RhoValueConverter
|
46
46
|
{
|
@@ -2,11 +2,15 @@ RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_ALERT, "com/rhomobile/rhodes/alert/Al
|
|
2
2
|
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_BOOLEAN, "java/lang/Boolean")
|
3
3
|
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_CAMERA, "com/rhomobile/rhodes/camera/Camera")
|
4
4
|
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_SIGNATURE, "com/rhomobile/rhodes/signature/Signature")
|
5
|
+
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER, "com/rhomobile/rhodes/bluetooth/RhoBluetoothManager")
|
5
6
|
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_CAPABILITIES, "com/rhomobile/rhodes/Capabilities")
|
6
7
|
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_CONTACT, "com/rhomobile/rhodes/phonebook/Contact")
|
7
8
|
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_CONTACT_FIELD, "com/rhomobile/rhodes/phonebook/ContactField")
|
9
|
+
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_DATE, "java/util/Date")
|
8
10
|
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_DATE_TIME_PICKER, "com/rhomobile/rhodes/datetime/DateTimePicker")
|
9
11
|
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_DOUBLE, "java/lang/Double")
|
12
|
+
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_EVENT, "com/rhomobile/rhodes/event/Event")
|
13
|
+
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_EVENT_STORE, "com/rhomobile/rhodes/event/EventStore")
|
10
14
|
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_FILEDESCRIPTOR, "java/io/FileDescriptor")
|
11
15
|
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_FLOAT, "java/lang/Float")
|
12
16
|
RHODES_DEFINE_JAVA_CLASS(RHODES_JAVA_CLASS_GEO_LOCATION, "com/rhomobile/rhodes/geolocation/GeoLocation")
|
@@ -149,6 +149,22 @@ JNIEXPORT void JNICALL Java_com_rhomobile_rhodes_RhodesService_onScreenOrientati
|
|
149
149
|
JNIEXPORT void JNICALL Java_com_rhomobile_rhodes_RhodesService_nativeInitPath
|
150
150
|
(JNIEnv *, jobject, jstring, jstring, jstring);
|
151
151
|
|
152
|
+
/*
|
153
|
+
* Class: com_rhomobile_rhodes_RhodesService
|
154
|
+
* Method: setPushRegistrationId
|
155
|
+
* Signature: (Ljava/lang/String;)V
|
156
|
+
*/
|
157
|
+
JNIEXPORT void JNICALL Java_com_rhomobile_rhodes_RhodesService_setPushRegistrationId
|
158
|
+
(JNIEnv *, jobject, jstring);
|
159
|
+
|
160
|
+
/*
|
161
|
+
* Class: com_rhomobile_rhodes_RhodesService
|
162
|
+
* Method: callPushCallback
|
163
|
+
* Signature: (Ljava/lang/String;)V
|
164
|
+
*/
|
165
|
+
JNIEXPORT void JNICALL Java_com_rhomobile_rhodes_RhodesService_callPushCallback
|
166
|
+
(JNIEnv *, jobject, jstring);
|
167
|
+
|
152
168
|
#ifdef __cplusplus
|
153
169
|
}
|
154
170
|
#endif
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/* DO NOT EDIT THIS FILE - it is machine generated */
|
2
|
+
#include <jni.h>
|
3
|
+
/* Header for class com_rhomobile_rhodes_signature_Signature */
|
4
|
+
|
5
|
+
#ifndef _Included_com_rhomobile_rhodes_bluetooth_RhoBluetoothManager
|
6
|
+
#define _Included_com_rhomobile_rhodes_bluetooth_RhoBluetoothManager
|
7
|
+
#ifdef __cplusplus
|
8
|
+
extern "C" {
|
9
|
+
#endif
|
10
|
+
/*
|
11
|
+
* Class: com_rhomobile_rhodes_bluetooth_RhoBluetoothManager
|
12
|
+
* Method: callback
|
13
|
+
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V
|
14
|
+
*/
|
15
|
+
JNIEXPORT void JNICALL Java_com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_onCallback
|
16
|
+
(JNIEnv *, jclass, jstring, jstring);
|
17
|
+
|
18
|
+
#ifdef __cplusplus
|
19
|
+
}
|
20
|
+
#endif
|
21
|
+
#endif
|
@@ -0,0 +1,169 @@
|
|
1
|
+
#include "rhodes/JNIRhodes.h"
|
2
|
+
#include <android/log.h>
|
3
|
+
|
4
|
+
#include <common/RhoConf.h>
|
5
|
+
#include <logging/RhoLogConf.h>
|
6
|
+
#include <common/RhodesApp.h>
|
7
|
+
#include <sync/SyncThread.h>
|
8
|
+
|
9
|
+
#include <sys/stat.h>
|
10
|
+
#include <sys/resource.h>
|
11
|
+
|
12
|
+
#include "rhodes/JNIRhodes.h"
|
13
|
+
|
14
|
+
#include <common/rhoparams.h>
|
15
|
+
|
16
|
+
#undef DEFAULT_LOGCATEGORY
|
17
|
+
#define DEFAULT_LOGCATEGORY "Bluetooth"
|
18
|
+
|
19
|
+
|
20
|
+
#include "rhodes/jni/com_rhomobile_rhodes_bluetooth_RhoBluetoothManager.h"
|
21
|
+
|
22
|
+
#include <common/RhodesApp.h>
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_bluetooth_RhoBluetoothManager_onCallback
|
30
|
+
(JNIEnv *env, jclass, jstring callback_url, jstring body) {
|
31
|
+
|
32
|
+
rho_net_request_with_data(rho_http_normalizeurl(rho_cast<std::string>(callback_url).c_str()), rho_cast<std::string>(body).c_str());
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
RHO_GLOBAL int rho_bluetooth_is_bluetooth_available() {
|
37
|
+
JNIEnv *env = jnienv();
|
38
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
39
|
+
if (!cls) return 0;
|
40
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "is_bluetooth_available", "()I");
|
41
|
+
if (!mid) return 0;
|
42
|
+
return env->CallStaticIntMethod(cls, mid);
|
43
|
+
}
|
44
|
+
|
45
|
+
RHO_GLOBAL void rho_bluetooth_off_bluetooth() {
|
46
|
+
JNIEnv *env = jnienv();
|
47
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
48
|
+
if (!cls) return;
|
49
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "off_bluetooth", "()V");
|
50
|
+
if (!mid) return;
|
51
|
+
env->CallStaticVoidMethod(cls, mid);
|
52
|
+
}
|
53
|
+
|
54
|
+
RHO_GLOBAL void rho_bluetooth_set_device_name(const char* device_name) {
|
55
|
+
JNIEnv *env = jnienv();
|
56
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
57
|
+
if (!cls) return;
|
58
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "set_device_name", "(Ljava/lang/String;)V");
|
59
|
+
if (!mid) return;
|
60
|
+
jstring objDeviceName = rho_cast<jstring>(device_name);
|
61
|
+
env->CallStaticVoidMethod(cls, mid, objDeviceName);
|
62
|
+
env->DeleteLocalRef(objDeviceName);
|
63
|
+
}
|
64
|
+
|
65
|
+
RHO_GLOBAL const char* rho_bluetooth_get_device_name() {
|
66
|
+
JNIEnv *env = jnienv();
|
67
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
68
|
+
if (!cls) return 0;
|
69
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "get_device_name", "()Ljava/lang/String;");
|
70
|
+
if (!mid) return 0;
|
71
|
+
jstring name = (jstring)env->CallStaticObjectMethod(cls, mid);
|
72
|
+
if (!name) return 0;
|
73
|
+
const char* cname = rho_cast<std::string>(name).c_str();
|
74
|
+
RAWLOG_INFO1("rho_bluetooth_get_device_name() : %s", cname);
|
75
|
+
return cname;
|
76
|
+
}
|
77
|
+
|
78
|
+
RHO_GLOBAL const char* rho_bluetooth_get_last_error() {
|
79
|
+
JNIEnv *env = jnienv();
|
80
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
81
|
+
if (!cls) return 0;
|
82
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "get_last_error", "()Ljava/lang/String;");
|
83
|
+
if (!mid) return 0;
|
84
|
+
jstring name = (jstring)env->CallStaticObjectMethod(cls, mid);
|
85
|
+
return rho_cast<std::string>(name).c_str();
|
86
|
+
}
|
87
|
+
|
88
|
+
RHO_GLOBAL const char* rho_bluetooth_create_session(const char* role, const char* callback_url) {
|
89
|
+
JNIEnv *env = jnienv();
|
90
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
91
|
+
if (!cls) return 0;
|
92
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "create_session", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;");
|
93
|
+
if (!mid) return 0;
|
94
|
+
jstring objStr1 = rho_cast<jstring>(role);
|
95
|
+
jstring objStr2 = rho_cast<jstring>(callback_url);
|
96
|
+
jstring res = (jstring)env->CallStaticObjectMethod(cls, mid, objStr1, objStr2);
|
97
|
+
env->DeleteLocalRef(objStr1);
|
98
|
+
env->DeleteLocalRef(objStr2);
|
99
|
+
return rho_cast<std::string>(res).c_str();
|
100
|
+
}
|
101
|
+
|
102
|
+
RHO_GLOBAL void rho_bluetooth_session_set_callback(const char* connected_device_name, const char* callback_url) {
|
103
|
+
JNIEnv *env = jnienv();
|
104
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
105
|
+
if (!cls) return;
|
106
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_set_callback", "(Ljava/lang/String;Ljava/lang/String;)V");
|
107
|
+
if (!mid) return;
|
108
|
+
jstring objStr1 = rho_cast<jstring>(connected_device_name);
|
109
|
+
jstring objStr2 = rho_cast<jstring>(callback_url);
|
110
|
+
env->CallStaticVoidMethod(cls, mid, objStr1, objStr2);
|
111
|
+
env->DeleteLocalRef(objStr1);
|
112
|
+
env->DeleteLocalRef(objStr2);
|
113
|
+
}
|
114
|
+
|
115
|
+
RHO_GLOBAL void rho_bluetooth_session_disconnect(const char* connected_device_name) {
|
116
|
+
JNIEnv *env = jnienv();
|
117
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
118
|
+
if (!cls) return;
|
119
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_disconnect", "(Ljava/lang/String;)V");
|
120
|
+
if (!mid) return;
|
121
|
+
jstring objStr1 = rho_cast<jstring>(connected_device_name);
|
122
|
+
env->CallStaticVoidMethod(cls, mid, objStr1);
|
123
|
+
env->DeleteLocalRef(objStr1);
|
124
|
+
}
|
125
|
+
|
126
|
+
RHO_GLOBAL int rho_bluetooth_session_get_status(const char* connected_device_name) {
|
127
|
+
JNIEnv *env = jnienv();
|
128
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
129
|
+
if (!cls) return 0;
|
130
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_get_status", "(Ljava/lang/String;)I");
|
131
|
+
jstring objStr1 = rho_cast<jstring>(connected_device_name);
|
132
|
+
if (!mid) return 0;
|
133
|
+
int res = env->CallStaticIntMethod(cls, mid, objStr1);
|
134
|
+
env->DeleteLocalRef(objStr1);
|
135
|
+
return res;
|
136
|
+
}
|
137
|
+
|
138
|
+
RHO_GLOBAL const char* rho_bluetooth_session_read_string(const char* connected_device_name) {
|
139
|
+
JNIEnv *env = jnienv();
|
140
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
141
|
+
if (!cls) return 0;
|
142
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_read_string", "(Ljava/lang/String;)Ljava/lang/String;");
|
143
|
+
jstring objStr1 = rho_cast<jstring>(connected_device_name);
|
144
|
+
if (!mid) return 0;
|
145
|
+
jstring res = (jstring)env->CallStaticObjectMethod(cls, mid, objStr1);
|
146
|
+
env->DeleteLocalRef(objStr1);
|
147
|
+
return rho_cast<std::string>(res).c_str();
|
148
|
+
}
|
149
|
+
|
150
|
+
RHO_GLOBAL void rho_bluetooth_session_write_string(const char* connected_device_name, const char* str) {
|
151
|
+
JNIEnv *env = jnienv();
|
152
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
|
153
|
+
if (!cls) return;
|
154
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "session_write_string", "(Ljava/lang/String;Ljava/lang/String;)V");
|
155
|
+
if (!mid) return;
|
156
|
+
jstring objStr1 = rho_cast<jstring>(connected_device_name);
|
157
|
+
jstring objStr2 = rho_cast<jstring>(str);
|
158
|
+
env->CallStaticVoidMethod(cls, mid, objStr1, objStr2);
|
159
|
+
env->DeleteLocalRef(objStr1);
|
160
|
+
env->DeleteLocalRef(objStr2);
|
161
|
+
}
|
162
|
+
|
163
|
+
RHO_GLOBAL VALUE rho_bluetooth_session_read_data(const char* connected_device_name) {
|
164
|
+
return 0;
|
165
|
+
}
|
166
|
+
|
167
|
+
RHO_GLOBAL void rho_bluetooth_session_write_data(const char* connected_device_name, VALUE data) {
|
168
|
+
}
|
169
|
+
|