Re: [fpc-pascal] fpcjvm code for examination

2019-08-23 Thread Mgr. Janusz Chmiel
So I have found out my bug. Why WIFIlock did not work as expected. I 
have put wrong number. So The right lines are:


  WifiManager := ANWWifiManager(getSystemService(ACContext.WIFI_SERVICE));
WifiManager.createWifiLock (3,'WIFI_MODE_FULL');
Wakelock number is correct.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] USB Human Interface Devices

2019-08-23 Thread Stefan V. Pantazi
Thanks for pushing on this. I think any pending timeout/transfer must be 
explicitly canceled before closing the USB device, so that the thread 
can end gracefully.


The only way I see is to use something like

libusb_handle_events_timeout_completed  

http://libusb.sourceforge.net/api-1.0/group__poll.html#ga43e52b912a760b41a0cf8a4a472fbd5b


before closing the USB device context.

That function is not currently part of the libusbx and has a time_t 
parameter that appears C-specific but for some reason is not included in 
ctypes unit. But I am sure Pascal equivalents can be defined. I will do 
some tests to include the libusb_handle_events_timeout_completed in 
libusbx and libusbhid and let you know.




On 8/23/19 7:07 AM, James Richters wrote:

Stefan ,
Do you get the following errors when you exit your program?   Is there some way 
I should shut down the read thread so I don't get this error?  I've been using 
a timeout of 0


libusb: error [do_close] Device handle closed while transfer was still being 
processed, but the device is still connected as far as we know
libusb: error [do_close] A cancellation hasn't even been scheduled on the 
transfer for which the device is closing
libusb: warning [libusb_exit] some libusb_devices were leaked
Assertion failed!

Program: i:\programming\gcode\libusbxhid\whb04b-4_test.exe
File: os/poll_windows.c, Line 145

Expression: fd != NULL
Heap dump by heaptrc unit of i:\programming\gcode\libusbxhid\whb04b-4_test.exe
50 memory blocks allocated : 1782/1968
50 memory blocks freed : 1782/1968
0 unfreed memory blocks : 0
True heap size : 131072 (160 used in System startup)
True free heap : 130912
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



--
___
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] fpcjvm code for examination

2019-08-23 Thread Mgr. Janusz Chmiel
Because my Java knowledge are very very very weak my attempts to call 
new Android API functions consists of GOogle search engine which shows 
Me some code examples from various WEB pages. And after that, I do my 
best to adapt those samples so it would be compatible with FPCJVM 
Android target. I have some lines of code and I believe, that there is 
some good human being who will examine my short code. Is code is 
unusable, please send AN repaired lines.
The biggest issue is, that when interacting with Android APIS, in many 
cases, The fact, that run-time library do not report run-time error or 
other bug do not mean, that code is really functional. Even The fact, 
that Android System UI will not report some crash message it do not mean 
that The code is good from The semantic perspective.

Here are my codes.
I Am using AndroidR15 APi headers and Pandroid Bundle.

  public
WifiManager : ANWWifiManager;
wakeLock : AOPowerManager;
The code is inside The following procedure.
procedure MainActivity.onCreate(savedInstanceState: AOBundle);

wakeLock := AOPowerManager(getSystemService(ACContext.POWER_SERVICE));
wakeLock.newWakeLock (1, '"Migration');
  WifiManager := ANWWifiManager(getSystemService(ACContext.WIFI_SERVICE));
WifiManager.createWifiLock (1,'WIFI_MODE_FULL');

Aim of my attempt is to have more sensitive Wifi chip signal detection 
and I want to have Partial Wakelock enabled to prevent Android from auto 
terminating unusable app after more time when device is not being 
charged and phone screen have been turned off.

The important questions are.
Does my code react? So are those lines functional? Or it do not react at 
all and I have some bug?

Sure. I have added The following important Android permissions.
    
    
I do not have compilation errors The code is example without Begin, ETC. 
But I have fully compilable code. I only need to know, if Wifilock and 
Wakelock really work or no.

Thank you very much for yours time and help.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] USB Human Interface Devices

2019-08-23 Thread James Richters
Stefan ,
Do you get the following errors when you exit your program?   Is there some way 
I should shut down the read thread so I don't get this error?  I've been using 
a timeout of 0


libusb: error [do_close] Device handle closed while transfer was still being 
processed, but the device is still connected as far as we know
libusb: error [do_close] A cancellation hasn't even been scheduled on the 
transfer for which the device is closing
libusb: warning [libusb_exit] some libusb_devices were leaked
Assertion failed!

Program: i:\programming\gcode\libusbxhid\whb04b-4_test.exe
File: os/poll_windows.c, Line 145

Expression: fd != NULL
Heap dump by heaptrc unit of i:\programming\gcode\libusbxhid\whb04b-4_test.exe
50 memory blocks allocated : 1782/1968
50 memory blocks freed : 1782/1968
0 unfreed memory blocks : 0
True heap size : 131072 (160 used in System startup)
True free heap : 130912
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal