Liz
Members-
Content Count
9 -
Joined
-
Last visited
Everything posted by Liz
-
Hello, I am working with Rad Studio and I need to make an application in Delphi for the phone that connects via USB to an Esp32 and sends and receives data. I didn't find anything available for delphi, so I chose to download a java library that handles it(https://github.com/mik3y/usb-serial-for-android), downloaded the .jar and converted it to .pas with java2op, but now I can't find a way to use the methods correctly and have the devices detected. by usb. Could you see this system, tell me how I could call the classes and methods in the interface or do you have some direct form of Delphi that allows me to make the connections with the USBs or at least see the connected devices usb-serial-for-android-3.8.0.jar JavaInterfaces.pas
-
I probe it today with esp32 and it works. Thank you. The problem with static functions and all that, i just copy from JUsbManagerClass to JUsbManager and it works. I just need now how work withe send data and receive in pascal. these are the instructions of the library in java but how i convert to delphi: then use direct read/write port.write(request, WRITE_WAIT_MILLIS); len = port.read(response, READ_WAIT_MILLIS); or direct write + event driven read: usbIoManager = new SerialInputOutputManager(usbSerialPort, this); usbIoManager.start(); ... port.write("hello".getBytes(), WRITE_WAIT_MILLIS); @Override public void onNewData(byte[] data) { runOnUiThread(() -> { textView.append(new String(data)); }); }
-
I'm using Rad Studio 12, I know it's not the latest. I'll try to install the latest one and see. Could you try converting the .jar with java2op and see if it converts the methods correctly and send it to me?
-
Yes, no problem, I realized later, I already put the ´driver´ and it didn't cause any problems. What do you recommend? Should I use java2op again to transfer the .jar to .pas or look for another alternative?
-
The problem is next: JUsbManagerClass = interface(JObjectClass) ['{1048A6E9-E1B5-4DA5-A168-ED91E8DE5284}'] {class} function _GetACTION_USB_ACCESSORY_ATTACHED: JString; cdecl; {class} function _GetACTION_USB_ACCESSORY_DETACHED: JString; cdecl; {class} function _GetACTION_USB_DEVICE_ATTACHED: JString; cdecl; {class} function _GetACTION_USB_DEVICE_DETACHED: JString; cdecl; {class} function _GetEXTRA_ACCESSORY: JString; cdecl; {class} function _GetEXTRA_DEVICE: JString; cdecl; {class} function _GetEXTRA_PERMISSION_GRANTED: JString; cdecl; {class} function getAccessoryList: TJavaObjectArray<JUsbAccessory>; cdecl; {class} function getDeviceList: JHashMap; cdecl; {class} function openDevice(device: JUsbDevice): JUsbDeviceConnection; cdecl;//Deprecated {class} procedure requestPermission(device: JUsbDevice; pi: JPendingIntent); cdecl; overload;//Deprecated {class} procedure requestPermission(accessory: JUsbAccessory; pi: JPendingIntent); cdecl; overload;//Deprecated {class} property ACTION_USB_ACCESSORY_ATTACHED: JString read _GetACTION_USB_ACCESSORY_ATTACHED; {class} property ACTION_USB_ACCESSORY_DETACHED: JString read _GetACTION_USB_ACCESSORY_DETACHED; {class} property ACTION_USB_DEVICE_ATTACHED: JString read _GetACTION_USB_DEVICE_ATTACHED; {class} property ACTION_USB_DEVICE_DETACHED: JString read _GetACTION_USB_DEVICE_DETACHED; {class} property EXTRA_ACCESSORY: JString read _GetEXTRA_ACCESSORY; {class} property EXTRA_DEVICE: JString read _GetEXTRA_DEVICE; {class} property EXTRA_PERMISSION_GRANTED: JString read _GetEXTRA_PERMISSION_GRANTED; end; [JavaSignature('android/hardware/usb/UsbManager')] JUsbManager = interface(JObject) ['{6F603A25-E816-4012-9B23-054B428A4A75}'] function hasPermission(device: JUsbDevice): Boolean; cdecl; overload;//Deprecated function hasPermission(accessory: JUsbAccessory): Boolean; cdecl; overload;//Deprecated function openAccessory(accessory: JUsbAccessory): JParcelFileDescriptor; cdecl;//Deprecated end; TJUsbManager = class(TJavaGenericImport<JUsbManagerClass, JUsbManager>) end; Here, for example, it doesn't let me use the openDevice that is in JUsbManagerClass. In other words, I can't find a way to access those functions of that class, however, those of JUsbManager if possible. I don't know how to wrap that. In your example I get two errors here: port := TJUsbSerialDriver.Wrap(availableDrivers.get(0)); connection := manager.openDevice(driver.getDevice); It tells me: [DCC Error] usb.pas(48): E2010 Incompatible types: 'JUsbSerialPort' and 'JUsbSerialDriver' [DCC Error] usb.pas(49): E2003 Undeclared identifier: 'openDevice'
-
Yes, I think I had already checked it, but for the project I need to do, which is for the school, the solution must be free. That's why I'm looking for even java solutions to use in rad studio delphi because I need it to be free. But that solution would be perfect but i cant afford that
-
Yes sorry, did it already
-
Hello, I am adapting the application that I am developing with a friend. A good part of the application has already been done but when we see the tabitems of the tabcontrol they appear compressed and the text cannot be read. I need help because they tell us that it is necessary to use a tabcontrol for the tabs. I attach photos of a simple example in Delphi for better understanding
-
I need some code for a multidevice application in Delphi that allows you to select a csv file from the phone's file manager and display it in a TStringList. Please, I have already searched a lot and nothing, I just need a small code that works for that, because I have been using some alternatives from the Katri library but when I select the csv it gives me the address but then it tells me file not found and it tells me the same address, I don't know if it's a matter of how Android handles addresses or something. Thanks in advance