Java Question nfc bluetooth reader sdk jar file

dragonguy

Active Member
Licensed User
Longtime User
Hi guys, i need to develop the new nfc bluetooth reader device for android system use.
they give me the android sample source code,sdk api data and the sdk jar file.
now is it i need to wrap the sdk jar to b4a library, then i can use in b4a?
just need to confirm and then start to work. i'm really dont know how to wrap the library,
this is my first time, but i'll try my best to learn to wrap the library. if i have a question can i ask at here?
 

DonManfred

Expert
Licensed User
Longtime User
Upload the samplecode and the jar file. Or post a link to their sdk site... Without knowing what you are trying to archieve it is hard to help.
Most probably you need a wrap for b4a. Maybe you can use javaobject to access the jars mehods.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi guys, i need to develop the new nfc bluetooth reader device for android system use.
they give me the android sample source code,sdk api data and the sdk jar file.
now is it i need to wrap the sdk jar to b4a library, then i can use in b4a?
just need to confirm and then start to work. i'm really dont know how to wrap the library,
this is my first time, but i'll try my best to learn to wrap the library. if i have a question can i ask at here?
Yes, you need to wrap the SDK so that you can use it in B4A. Best place to start is with the sample source code that you have.
 

dragonguy

Active Member
Licensed User
Longtime User
First I start the new java project from Eclipse, then add jar reference to the android project.
Android.jar, B4AShared.jar, dk-ble-nfc-sdk.jar(sdk jar) and copy sdk jar to B4A additional libraries folder
(question 1 is about core.jar is it need to add to reference?)
I like to know these step is it correct?
 

dragonguy

Active Member
Licensed User
Longtime User
i'm not yet wrap, but now start with simple setting
B4X:
package com.probitto.my;

import anywheresoftware.b4a.AbsObjectWrapper;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
import anywheresoftware.b4a.BA.DependsOn;
import com.dk.bleNfc.*;

@Version(1.0f)
@ShortName("BluetoothNFC")
@DependsOn(values= {"ble-nfc-sdk"})
public class BLENfcWrapper {

}

that is beginning... these step is it correct?
 

dragonguy

Active Member
Licensed User
Longtime User
you need to add the jar in the buildconfig of your exlipse project.
You dont need to copy the core.jar to your eclipse-proect. Kust add an ref to an external jar.
is it like this setting?
 

Attachments

  • built_config.png
    built_config.png
    29.7 KB · Views: 309

dragonguy

Active Member
Licensed User
Longtime User
inside dk-ble-nfc-sdk.jar has a many different class.
first i want do is try wrap the Scanner class and ScannerCallback class.

Scanner and ScannerCallback class is mainly responsible for Bluetooth BLE search related functions.

Scanner class refer with sdk readme document:
B4X:
Public Scanner (Context context, ScannerCallback callback)
'Scanner class initialization, callback for the search callback function, please refer to the ScannerCallback class

Public void startScan ()
'Bluetooth BLE began to search, call this function will always search for Bluetooth until the search device so far.

Public void startScan (long scanPeriod)
'Bluetooth BLE starts searching with timeout parameters, scanPeriod parameter table searches for how many seconds to stop searching.

Public void stopScan ()
'Bluetooth BLE stops searching.

Public boolean isScanning ()
'Gets the status of the Bluetooth BLE search, true if it is searching for Bluetooth, false otherwise

here is ScannerCallback class:
B4X:
Public void onReceiveScanDevice (final BluetoothDevice device, final int rssi, final byte [] scanRecord)
'This interface is a Bluetooth BLE search result callback. Device for the search of the Bluetooth device instance; rssi for the Bluetooth signal strength,
'-100 ~ 0, -100 signal is the weakest, 0 signal the strongest; scanRceord for the search for the Bluetooth is the broadcast data.

Public void onScanDeviceStopped ()
'This interface stops the search callback.

but i dont know how to start :(

 

Johan Schoeman

Expert
Licensed User
Longtime User
inside dk-ble-nfc-sdk.jar has a many different class.
first i want do is try wrap the Scanner class and ScannerCallback class.

Scanner and ScannerCallback class is mainly responsible for Bluetooth BLE search related functions.

Scanner class refer with sdk readme document:
B4X:
Public Scanner (Context context, ScannerCallback callback)[/SIZE][/SIZE]
[SIZE=5][SIZE=4]'Scanner class initialization, callback for the search callback function, please refer to the ScannerCallback class

Public void startScan ()
'Bluetooth BLE began to search, call this function will always search for Bluetooth until the search device so far.

Public void startScan (long scanPeriod)
'Bluetooth BLE starts searching with timeout parameters, scanPeriod parameter table searches for how many seconds to stop searching.

Public void stopScan ()
'Bluetooth BLE stops searching.

Public boolean isScanning ()
'Gets the status of the Bluetooth BLE search, true if it is searching for Bluetooth, false otherwise

here is ScannerCallback class:
B4X:
Public void onReceiveScanDevice (final BluetoothDevice device, final int rssi, final byte [] scanRecord)[/SIZE][/SIZE]
[SIZE=5][SIZE=4]'This interface is a Bluetooth BLE search result callback. Device for the search of the Bluetooth device instance; rssi for the Bluetooth signal strength,
'-100 ~ 0, -100 signal is the weakest, 0 signal the strongest; scanRceord for the search for the Bluetooth is the broadcast data.

Public void onScanDeviceStopped ()
'This interface stops the search callback.

but i dont know how to start :(
I have looked at the SDK - not a simple project to wrap at all.
 
Top