{
struct sockaddr_rc loc_addr = { 0 }, rem_addr = { 0 };
char buf[1024] = { 0 };
int s, client, bytes_read;
socklen_t opt = sizeof(rem_addr);
// allocate socket
s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
// bind socket to port 1 of the first available
// local bluetooth adapter
loc_addr.rc_family = AF_BLUETOOTH;
loc_addr.rc_bdaddr = *BDADDR_ANY;
loc_addr.rc_channel = (uint8_t) 1;
bind(s, (struct sockaddr *)&loc_addr, sizeof(loc_addr*************************BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
// Device does not support Bluetooth
}
if (!mBluetoothAdapter.isEnabled()) {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}
How can I do this in native code, since my java wrapper is just a call into this code base.
thanks,
/mpd
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
Ok. While I don't understand the details of why it is not possi ble, since the bluetooth driver is accessable from linux with c code. Guess you may not know why either. If anyone knows what to change, let me know.
If I use the java api to enable the device and get a handle, will this allow me to move packet data to my native code space with un managed memory buffers?
Ok. While I don't understand the details of why it is not possi ble, since the bluetooth driver is accessable from linux with c code. Guess you may not know why either. If anyone knows what to change, let me know.
If I use the java api to enable the device and get a handle, will this allow me to move packet data to my native code space with un managed memory buffers?
#include <bluetooth/rfcomm.h>you can't assue this file exists on a device.
What header do I need to add to my ndk directory and where do they go inside the ndk?