Running mvn -Pios client:link results in undefined symbols - gluon-mobile

I'm new to building iOS apps and gluon-mobile....
I'm trying to build the GluonMobile-SingleViewProject as created by the IntelliJ Gluon Mobile plugin v2.8.5. I have not made any modification to the generated code. The compile phase seems to complete without issue but when running the mvn -Pios client:link command I end up getting a lot of Undefined symbol errors. I think I have followed all the steps in the gluon-mobile document but I can't seem to get past this error.
Below is the build output from the failing link task.
INFO] --- client-maven-plugin:0.1.36:link (default-cli) # gluonmobile-singleviewproject ---
[Wed Feb 24 22:02:11 PST 2021][INFO] ==================== LINK TASK ====================
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] Undefined symbols for architecture arm64:
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] "_JVM_NativePath", referenced from:
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_Get_From_Cache in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] "_JVM_RawMonitorCreate", referenced from:
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_Get_From_Cache in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_Put_In_Cache0 in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] "_JVM_RawMonitorDestroy", referenced from:
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _freeZip in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] "_JVM_RawMonitorEnter", referenced from:
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_Get_From_Cache in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_Put_In_Cache0 in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_Close in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_FreeEntry in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_Lock in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_GetEntry2 in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_GetNextEntry in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] ...
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] "_JVM_RawMonitorExit", referenced from:
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_Get_From_Cache in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_Put_In_Cache0 in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_Close in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_FreeEntry in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_Unlock in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_GetEntry2 in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] _ZIP_GetNextEntry in libzip.a(zip_util.o)
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] ...
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] ld: symbol(s) not found for architecture arm64
[Wed Feb 24 22:02:15 PST 2021][INFO] [SUB] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[Wed Feb 24 22:02:15 PST 2021][SEVERE] Process link failed with result: 1
This is on macOS bigSur (11.0.1) running Xcode 12.4.
Any and all help appreciated.
Thanks,
Joshua

Related

Gluon Mobile : Bluetooth Low Energy, how to connect to a device with a given mac address after scanning?

I have a problem to connect to an arduino nano sense 33 BLE. The arduino module contains a profile which has a UUID.
Is it possible to connect to the arduino from the mac address to get profiles UUID then characteristics and finaly read the founded characteristics ?
This is how I proceed :
BleDevice device = new BleDevice();
device.setAddress("E4:38:4F:DA:9F:94"); // MAC ADDRESS of arduino
BleService bleService = BleService.create().get();
bleService.connect(device); // Connect to device
List<BleProfile> list_of_profiles = device.getProfiles(); // Get list of profiles
for(BleProfile profile : list_of_profiles){
System.out.println(profile.getUuid());// display uuid of profiles
//Then get characteristics from profile
//Then read characteristics
}
EDIT :
Scan function updated : This is how I proceed for scanning devices :
public void scan_4_devices(){
long t= System.currentTimeMillis();
long end = t+5000;
System.out.println("searching for devices ...");
BleService.create().ifPresent(ble -> {
ObservableList<BleDevice> ble_list_device = ble.startScanningDevices();
System.out.println("SIZE BEFORE while loop : "+ble_list_device.size());
ble_list_device.addListener((ListChangeListener<BleDevice>) c -> {
while (c.next() && System.currentTimeMillis() < end ) {
System.out.println("SIZE IN while loop : "+ble_list_device.size());
if (c.wasAdded()) {
for (BleDevice device : c.getAddedSubList()) {
System.out.println("Device found: " + device.getName());
}
}
}
ble.stopScanningDevices();
});
});
}
What I'm trying to do is a device search for 5 seconds, if the time is exceeded then I stop the device search. But the application keep crashing, this is the stacktrace after the crash.
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] V/GraalActivity(27191): Activity, get touch event, pcount = 1
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] E/GraalGluon(27191): Native Dalvik layer got touch event, pass to native Graal layer...
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] E/GraalGluon(27191): Native Dalvik layer got touch event, passed to native Graal layer...
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): traceEvent: Pushing TouchState[1,TouchState.Point[id=0,x=688,y=28]] to TouchPipeline[SmallMove]
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): traceEvent: Applying SmallMove to TouchState[1,TouchState.Point[id=0,x=688,y=28]]
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): traceEvent: Set TouchState[1,TouchState.Point[id=0,x=688,y=28]]
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): traceEvent: Set MouseState[x=688,y=28,wheel=0,buttonsPressed=IntSet[212]]
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): PPSRenderer: scenario.effect - createShader: Blend_SRC_IN
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] V/GraalActivity(27191): Activity, get touch event, pcount = 1
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] E/GraalGluon(27191): Native Dalvik layer got touch event, pass to native Graal layer...
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] E/GraalGluon(27191): Native Dalvik layer got touch event, passed to native Graal layer...
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] V/GraalActivity(27191): Activity, get touch event, pcount = 1
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] E/GraalGluon(27191): Native Dalvik layer got touch event, pass to native Graal layer...
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): don't add points, primary = -1
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] E/GraalGluon(27191): Native Dalvik layer got touch event, passed to native Graal layer...
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): traceEvent: Pushing TouchState[1,TouchState.Point[id=0,x=688,y=28]] to TouchPipeline[SmallMove]
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): traceEvent: Applying SmallMove to TouchState[1,TouchState.Point[id=0,x=688,y=28]]
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): traceEvent: Set TouchState[1,TouchState.Point[id=0,x=688,y=28]]
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): traceEvent: Pushing TouchState[0] to TouchPipeline[SmallMove]
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): traceEvent: Applying SmallMove to TouchState[0]
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): traceEvent: Set TouchState[0]
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): traceEvent: Set MouseState[x=688,y=28,wheel=0,buttonsPressed=IntSet[]]
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): searching for devices ...
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] I/GluonAttach(27191): JNI_OnLoad_ble called
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GluonAttach(27191): [BLESERVICE] Initializing native BLE from OnLoad
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalGluon(27191): ATTACH_DALVIK, tid = 27218, existed? 0, dalvikEnv at 0x7db4883200
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GluonAttach(27191): Util :: Load className com/gluonhq/helloandroid/DalvikBleService
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalGluon(27191): ATTACH_DALVIK, tid = 27218, existed? 1, dalvikEnv at 0x7db4883200
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] V/GluonAttach(27191): DalvikBle, init
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] V/GluonAttach(27191): Util <init>
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GluonAttach(27191): Calling Verify Permissions from Attach::Util
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] V/GraalActivity(27191): PermissionRequestActivity::Calling verifyPermissions
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] V/GraalActivity(27191): All requested permissions are granted
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GluonAttach(27191): Verify Permissions from native Attach::Util done
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalGluon(27191): DETACH_DALVIK, tid = 27218, existed = 1, env at 0x7db4883200
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GluonAttach(27191): Initializing native Ble done
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalGluon(27191): ATTACH_DALVIK, tid = 27218, existed? 1, dalvikEnv at 0x7db4883200
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] V/GluonAttach(27191): BLE startScanningPeripherals
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalGluon(27191): DETACH_DALVIK, tid = 27218, existed = 1, env at 0x7db4883200
[mar. mars 30 10:05:13 CEST 2021][INFO] [SUB] D/GraalCompiled(27191): SIZE BEFORE while loop : 0
[mar. mars 30 10:06:21 CEST 2021][INFO] [SUB] --------- beginning of crash
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): ANR in com.hacare.ehacarebox (com.hacare.ehacarebox/com.gluonhq.helloandroid.MainActivity)
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): PID: 27191
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 34. Wait queue head age: 27397.5ms.)
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): Load: 7.93 / 7.95 / 7.83
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): CPU usage from 126795ms to 0ms ago (2021-03-30 10:04:15.526 to 2021-03-30 10:06:22.321):
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 11% 2867/system_server: 4% user + 7% kernel / faults: 21744 minor 78 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 4% 707/android.hardware.sensors#1.0-service: 1.3% user + 2.6% kernel / faults: 21 minor 5 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 2.4% 623/logd: 0.7% user + 1.7% kernel / faults: 539 minor 1 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 1.8% 23194/kworker/u16:11: 0% user + 1.8% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 2.1% 12638/com.android.bluetooth: 1.2% user + 0.9% kernel / faults: 2319 minor 6 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 2% 3318/com.android.systemui: 1.5% user + 0.5% kernel / faults: 7928 minor 376 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 1.7% 26869/kworker/u16:3: 0% user + 1.7% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 1.6% 23173/kworker/u16:9: 0% user + 1.6% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 1.3% 23196/kworker/u16:14: 0% user + 1.3% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.6% 24530/kworker/u16:0: 0% user + 0.6% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.9% 10811/com.sec.phone: 0.5% user + 0.3% kernel / faults: 171 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.8% 20538/kworker/u16:4: 0% user + 0.8% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.8% 732/surfaceflinger: 0.5% user + 0.3% kernel / faults: 308 minor 16 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.6% 702/android.hardware.graphics.composer#2.1-service: 0.2% user + 0.3% kernel / faults: 96 minor 2 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.5% 695/android.hardware.bluetooth#1.0-service-qti: 0.1% user + 0.3% kernel / faults: 15 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.4% 401/cfinteractive: 0% user + 0.4% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.3% 20184/com.google.android.googlequicksearchbox:search: 0.3% user + 0% kernel / faults: 3639 minor 16 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.3% 3/ksoftirqd/0: 0% user + 0.3% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.3% 80/smem_native_rpm: 0% user + 0.3% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.2% 13990/logcat: 0% user + 0.1% kernel / faults: 29 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 1//init: 0.1% user + 0% kernel / faults: 221 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 23078/mdss_fb0: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 29022/com.google.android.gms.persistent: 0.1% user + 0% kernel / faults: 543 minor 1 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 15/ksoftirqd/1: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 29/ksoftirqd/3: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 123/kswapd0: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 710/android.hardware.wifi#1.0-service: 0% user + 0.1% kernel / faults: 14 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 273/kgsl_worker_thr: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 25576/kworker/0:1: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 7/rcu_preempt: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 3096/cds_mc_thread: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 89/kcompactd0: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 26744/kworker/1:0: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 3307/com.sec.android.inputmethod: 0% user + 0% kernel / faults: 134 minor 5 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 3927/iod: 0% user + 0% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 10/rcuop/0: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 95/system: 0% user + 0.1% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0.1% 624/servicemanager: 0% user + 0% kernel / faults: 4 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 26753/kworker/3:2: 0% user + 0% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 22/ksoftirqd/2: 0% user + 0% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 348/irq/305-fts_tou: 0% user + 0% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 25/rcuop/2: 0% user + 0% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 31420/adbd: 0% user + 0% kernel / faults: 642 minor 2 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 701/android.hardware.graphics.allocator#2.0-service: 0% user + 0% kernel / faults: 57 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 717/healthd: 0% user + 0% kernel / faults: 7 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 4187/com.sec.android.app.launcher: 0% user + 0% kernel / faults: 2727 minor 3 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 191/msm_serial_hs_0: 0% user + 0% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 2660/cnss-daemon: 0% user + 0% kernel / faults: 33 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 20087/com.google.android.gms: 0% user + 0% kernel / faults: 875 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 910/wlan_logging_th: 0% user + 0% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 27044/kworker/2:4: 0% user + 0% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 23224/com.android.vending: 0% user + 0% kernel / faults: 910 minor 3 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 18/rcuop/1: 0% user + 0% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 407/irq/181-spdm_bw: 0% user + 0% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 705/android.hardware.memtrack#1.0-service: 0% user + 0% kernel / faults: 12 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 5231/com.samsung.cmh:CMH: 0% user + 0% kernel / faults: 207 minor 3 major
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 26472/com.google.android.apps.docs: 0% user + 0% kernel / faults: 57 minor
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 79/dsps_smem_glink: 0% user + 0% kernel
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] E/ActivityManager( 2867): 0% 83/msm_wa
[mar. mars 30 10:06:25 CEST 2021][INFO] [SUB] W/ActivityManager( 2867): anr : com.hacare.ehacarebox,0
As you can see the size of the list ObservableList<BleDevice> ble_list_device = ble.startScanningDevices(); is 0. This may cause app crash
This is the main class source code:
package com.hacare;
import com.gluonhq.attach.util.Constants;
import com.hacare.views.PrimaryView;
import com.hacare.views.SecondaryView;
import com.gluonhq.charm.glisten.application.MobileApplication;
import com.gluonhq.charm.glisten.visual.Swatch;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
public class Main extends MobileApplication {
public static final String PRIMARY_VIEW = HOME_VIEW;
public static final String SECONDARY_VIEW = "test";
#Override
public void init() {
addViewFactory(PRIMARY_VIEW, () -> new PrimaryView().getView());
addViewFactory(SECONDARY_VIEW, () -> new SecondaryView().getView());
DrawerManager.buildDrawer(this);
}
#Override
public void postInit(Scene scene) {
Swatch.BLUE.assignTo(scene);
scene.getStylesheets().add(Main.class.getResource("style.css").toExternalForm());
((Stage) scene.getWindow()).getIcons().add(new Image(Main.class.getResourceAsStream("/icon.png")));
}
public static void main(String[] args) {
System.setProperty(Constants.ATTACH_DEBUG,"true");
launch(args);
}
}
Ideally, once you connect you should wait for the connection status, before you start asking for the list of profiles.
These are some code snippets you could use:
Device discovery
BleService.create().ifPresent(ble -> {
ObservableList<BleDevice> devices = ble.startScanningDevices();
...
ble.stopScanningDevices();
});
Device connect
BleService.create().ifPresent(ble -> {
device.stateProperty().addListener(new InvalidationListener() {
#Override
public void invalidated(Observable observable) {
if (State.STATE_CONNECTED.equals(device.getState())) {
// device connected, get profiles:
ObservableList<BleProfile> profiles = device.getProfiles();
...
device.stateProperty().removeListener(this);
}
}
});
ble.connect(device);
});
Profile characteristics
ObservableList<BleCharacteristic> characteristics = profile.getCharacteristics();
...
// read characteristic
BleService.create().ifPresent(ble ->
ble.readCharacteristic(device, profile.getUuid(), characteristic.getUuid());
// subscribe characteristic
BleService.create().ifPresent(ble ->
ble.subscribeCharacteristic(device, profile.getUuid(), characteristic.getUuid());
// write characteristic
BleService.create().ifPresent(ble ->
ble.writeCharacteristic(device, profile.getUuid(), characteristic.getUuid(), bytes));
...
Something have changed in the Android BLE Framework, for the moment the solution to fix this issue is to firstly change the attach version to 4.0.12-SNAPSHOT in pom.xml file.
<attach.version>4.0.12-SNAPSHOT</attach.version>
Then by adding the following repository :
<repository>
<id>Snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
Thanks to José Pereda

Concatenate several awk command outputs in one command

**I have an input like as follows with many, many rows, and I need to parse all this file into a better format, could be a CSV file or JSON (maybe in the future).
So I need to produce an outcome with columns delimited by a comma, thinking of being able to export the content in CSV file for now.
Get the name files
awk '{ if($2 ~ /A/ ) print $1 }' dir_out
Get all the paths
awt ' /[\\]/ {print}'
Get the size of the files
awk '{ if($3 ~ /^[0-9]/) print $3}'
Right now I have the individual commands to generate the desired result, however I have to find a way to put them in the same line of awk commands, or in a script.
One of the critical points that I have not been able to solve is to make column 1 of the outcome the path that delimits each block, for all the files in the block.
So I starting from this input:
**
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl
R0097A+05.00B-00-QingL.JPG A 6958377 Fri Jun 8 12:53:30 2018
R0097A+05.00B-00-QingLI.JPG A 2794933 Fri Jun 8 12:53:30 2018
R0097A+05.00B-00-QingLO.JPG A 1350397 Fri Jun 8 12:53:30 2018
R0097A+11.00B-00-QingL.JPG A 6997803 Fri Jun 8 12:53:30 2018
R0097A+11.00B-00-QingLI.JPG A 2783151 Fri Jun 8 12:53:30 2018
R0097A+11.00B-00-QingLO.JPG A 1338662 Fri Jun 8 12:53:30 2018
R0097A-00.00B-00-QingL.JPG A 7069740 Fri Jun 8 12:53:30 2018
R0097A-00.00B-00-QingLI.JPG A 2825705 Fri Jun 8 12:53:30 2018
R0097A-00.00B-00-QingLO.JPG A 1369520 Fri Jun 8 12:53:30 2018
Jhumbs.db A 20480 Fri Jun 8 13:14:41 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl
R0098A+05.00B-00-QingL.JPG A 6958377 Fri Jun 8 12:54:30 2018
R0098A+05.00B-00-QingLI.JPG A 2794933 Fri Jun 8 12:54:30 2018
R0098A+05.00B-00-QingLO.JPG A 1350398 Fri Jun 8 12:54:30 2018
R0098A+11.00B-00-QingL.JPG A 6998803 Fri Jun 8 12:54:30 2018
R0098A+11.00B-00-QingLI.JPG A 2783151 Fri Jun 8 12:54:30 2018
R0098A+11.00B-00-QingLO.JPG A 1338662 Fri Jun 8 12:54:30 2018
R0098A-00.00B-00-QingL.JPG A 7069840 Fri Jun 8 12:54:30 2018
R0098A-00.00B-00-QingLI.JPG A 2825705 Fri Jun 8 12:54:30 2018
R0098A-00.00B-00-QingLO.JPG A 1369520 Fri Jun 8 12:54:30 2018
Jhumbs.db A 20480 Fri Jun 8 13:14:41 2018`
ljkhlj
PATH, FILENAME, SIZE, TIMESTAMP
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+05.00B-00-QingL.JPG, 6958377, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+05.00B-00-QingLI.JPG, 2794933, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+05.00B-00-QingLI.JPG, 1350397, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+11.00B-00-QingL.JPG, 6997803, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+05.00B-00-QingL.JPG, 6958377, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+05.00B-00-QingLI.JPG, 6958377, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+05.00B-00-QingLO.JPG, 6958377, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+11.00B-00-QingL.JPG, 6958377, Fri Jun 8 12:54:30 2018
Here's a way of combining your awk command into a single script:
#!/bin/bash
awk '
$2 ~ /A/ {print $1; }
/[\\]/ {print}
$3 ~ /^[0-9]/ {print $3}
' "$#"
In general, awk takes multiple /search/ {command} pairs. If /search/ is missing, it defaults to all lines and if {command} is missing, it defaults to print.
Here's the additional logic you need to get your expected results:
#!/bin/bash
awk -v OFS=, '
BEGIN { print "PATH, FILENAME, SIZE, TIMESTAMP" }
/[\\]/ { path=$0 }
$2 ~ /A/ {print path,$1,$3,$4 " " $5 " " $6 " " $7 }
' "$#"
$ cat tst.awk
BEGIN {
OFS = ", "
print "PATH", "FILENAME", "SIZE", "TIMESTAMP"
}
/^ / {
file = $1
size = $3
sub(/^ ([^[:space:]]+[[:space:]]+){3}/,"")
print path, file, size, $0
next
}
{ path = $0 }
$ awk -f tst.awk file
PATH, FILENAME, SIZE, TIMESTAMP
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+05.00B-00-QingL.JPG, 6958377, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+05.00B-00-QingLI.JPG, 2794933, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+05.00B-00-QingLO.JPG, 1350397, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+11.00B-00-QingL.JPG, 6997803, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+11.00B-00-QingLI.JPG, 2783151, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+11.00B-00-QingLO.JPG, 1338662, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A-00.00B-00-QingL.JPG, 7069740, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A-00.00B-00-QingLI.JPG, 2825705, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A-00.00B-00-QingLO.JPG, 1369520, Fri Jun 8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, Jhumbs.db, 20480, Fri Jun 8 13:14:41 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+05.00B-00-QingL.JPG, 6958377, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+05.00B-00-QingLI.JPG, 2794933, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+05.00B-00-QingLO.JPG, 1350398, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+11.00B-00-QingL.JPG, 6998803, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+11.00B-00-QingLI.JPG, 2783151, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+11.00B-00-QingLO.JPG, 1338662, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A-00.00B-00-QingL.JPG, 7069840, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A-00.00B-00-QingLI.JPG, 2825705, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A-00.00B-00-QingLO.JPG, 1369520, Fri Jun 8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, Jhumbs.db, 20480, Fri Jun 8 13:14:41 2018

Generate random datetimes in rails with the minutes belongs to range(00, 30)

Event model which has start and end datetime attributes in the database. I want to seed some random events but the event time should be proper.
For example:
6.times { date_range << DateTime.now + (rand * 21) }
generates
[Thu, 03 Aug 2017 21:22:48 +0530,
Tue, 08 Aug 2017 17:36:29 +0530,
Sat, 29 Jul 2017 06:19:51 +0530,
Sat, 29 Jul 2017 13:36:21 +0530,
Thu, 27 Jul 2017 15:08:55 +0530,
Fri, 04 Aug 2017 13:53:03 +0530]
which is the correct behaviour.
But how to generate random datetime like this:
[Thu, 03 Aug 2017 21:00:00 +0530,
Tue, 08 Aug 2017 17:30:00 +0530,
Sat, 29 Jul 2017 06:00:00 +0530,
Sat, 29 Jul 2017 13:00:00 +0530,
Thu, 27 Jul 2017 15:30:00 +0530,
Fri, 04 Aug 2017 13:00:00 +0530]
So in order to display these events properly on a calendar.
Could try separating out each segment and adding them onto the date individually
date_range = 6.times.collect do
DateTime.now.beginning_of_day + # starting from today
rand(21).days + # pick a random day, no further than 3 weeks out
rand(24).hours + # move forward to a random hour on that day
(rand(2) * 30).minutes # and then decide whether to add 30 minutes
end
or, could combine the hours + minutes
date_range = 6.times.collect do
DateTime.now.beginning_of_day + # starting from today
rand(21).days + # pick a random day, no further than 3 weeks out
(rand(48) * 30).minutes # pick a random interval of 30 minutes to add in
end
Found the working solution but not complete:
6.times { date_range << DateTime.parse((DateTime.now + (rand * 21)).beginning_of_hour.to_s) }
[Mon, 31 Jul 2017 06:00:00 +0530,
Thu, 03 Aug 2017 15:00:00 +0530,
Fri, 11 Aug 2017 14:00:00 +0530,
Mon, 31 Jul 2017 09:00:00 +0530,
Wed, 09 Aug 2017 16:00:00 +0530,
Sat, 12 Aug 2017 13:00:00 +0530]
This can work for now but need some datetime with 30 minutes as well.

Why does moment-timezone display incorrect GMT offset for some timestamps in same timezone?

I'm using moment-timezone 0.5.1 on node 6.3.0
I'm primarily dealing with the Hong Kong timezone, which has been using GMT+0800 since 1904.
Before that, it was using GMT+0736 since 1885
Yet for some reason, moment-timezone formats some dates near the epoch to display GMT+0900, which doesn't seem to have any basis in history.
I can't seem to find the pattern nor can I reproduce this issue in more recent timestamps.
After epoch
moment.tz(123456780, 'Asia/Hong_Kong').toString() // 'Fri Jan 02 1970 18:17:36 GMT+0800'
moment.tz(1234567800, 'Asia/Hong_Kong').toString() // 'Thu Jan 15 1970 14:56:07 GMT+0800'
moment.tz(5999999999, 'Asia/Hong_Kong').toString() // 'Wed Mar 11 1970 18:39:59 GMT+0800'
moment.tz(9000000000, 'Asia/Hong_Kong').toString() // 'Wed Apr 15 1970 12:00:00 GMT+0800'
moment.tz(9300000000, 'Asia/Hong_Kong').toString() // 'Sat Apr 18 1970 23:20:00 GMT+0800'
moment.tz(12345678000, 'Asia/Hong_Kong').toString() // 'Sun May 24 1970 06:21:18 GMT+0900'
moment.tz(9999999999, 'Asia/Hong_Kong').toString() // 'Mon Apr 27 1970 02:46:39 GMT+0900'
moment.tz(9900000000, 'Asia/Hong_Kong').toString() // 'Sat Apr 25 1970 23:00:00 GMT+0900'
moment.tz(9500000000, 'Asia/Hong_Kong').toString() // 'Tue Apr 21 1970 07:53:20 GMT+0900'
moment.tz(9400000000, 'Asia/Hong_Kong').toString() // 'Mon Apr 20 1970 04:06:40 GMT+0900'
moment.tz(9400000000, 'Asia/Hong_Kong').toString() // 'Mon Apr 20 1970 04:06:40 GMT+0900'
Before epoch
moment.tz(-9000000000000, 'Asia/Hong_Kong').toString() // 'Thu Oct 19 1684 15:36:42 GMT+0736'
moment.tz(-90000000000000, 'Asia/Hong_Kong').toString() // 'Sun Jan 06 -0882 15:36:42 GMT+0736'
moment.tz(-500000000000, 'Asia/Hong_Kong').toString() // 'Sat Feb 27 1954 07:06:40 GMT+0800'
moment.tz(-100000000000, 'Asia/Hong_Kong').toString() // 'Mon Oct 31 1966 22:13:20 GMT+0800'
moment.tz(-900000000000, 'Asia/Hong_Kong').toString() // 'Wed Jun 25 1941 17:00:00 GMT+0900'
moment.tz(-200000000000, 'Asia/Hong_Kong').toString() // 'Sat Aug 31 1963 13:26:40 GMT+0900'
moment.tz(-800000000000, 'Asia/Hong_Kong').toString() // 'Sat Aug 26 1944 02:46:40 GMT+0900'
moment.tz(-900000000000, 'Asia/Hong_Kong').toString() // 'Wed Jun 25 1941 17:00:00 GMT+0900'
It seems like it's also a historical answer, based on Hong Kong's adoption of Daylight Savings Time:
Hong Kong adopted daylight saving measures in 1941. However, in the 1970s, the government found these measures unnecessary as Hong Kong is at a relatively low latitude. The practice was eliminated in 1979.
Taking a quick look at the difference between 1941 and 1942, that seems like where you see the switch between GMT+8 and GMT+9:
moment.tz(new Date('1/1/1941'), 'Asia/Hong_Kong').toString()
// 'Wed Jan 01 1941 16:00:00 GMT+0800'
moment.tz(new Date('1/1/1942'), 'Asia/Hong_Kong').toString()
// 'Thu Jan 01 1942 17:00:00 GMT+0900'

ActiveRecord does not respect daylight saving time (DST)?

We're in the timezone Bern, which is +0100. But since we're now in summertime (we have daylight saving time), the current offset is +0200. In my rails app, I set the timezone using a wrapper in the application controller since I need to have user-based timezones:
around_filter :user_timezone
def user_timezone(&block)
Time.use_zone(current_timezone, &block)
end
Now the strange part:
Time.zone.now # 2013-04-10 10:32:56 +0200
# (correct offset)
SomeArModel.first.created_at # 2013-03-28 17:49:59 +0100
# (incorrect offset, no DST)
Is there any explanation for this?
Thats normal behavior, the DST change happened on Sun Mar 31 01:00:00 UTC 2013.
t = Time.mktime(2013, 03, 31, 1, 15, 0)
6.times do
t += 900
u = Time.at(t.to_i).utc
puts t.to_s + " " + u.to_s
end
output:
Sun Mar 31 01:30:00 +0100 2013 Sun Mar 31 00:30:00 UTC 2013
Sun Mar 31 01:45:00 +0100 2013 Sun Mar 31 00:45:00 UTC 2013
Sun Mar 31 03:00:00 +0200 2013 Sun Mar 31 01:00:00 UTC 2013
Sun Mar 31 03:15:00 +0200 2013 Sun Mar 31 01:15:00 UTC 2013
Sun Mar 31 03:30:00 +0200 2013 Sun Mar 31 01:30:00 UTC 2013
Sun Mar 31 03:45:00 +0200 2013 Sun Mar 31 01:45:00 UTC 2013

Resources