All Projects → Agamnentzar → bluetooth-serial-port

Agamnentzar / bluetooth-serial-port

Licence: other
multi-platform bluetooth serial port library for C++

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
Objective-C++
1391 projects

Projects that are alternatives of or similar to bluetooth-serial-port

Gort
Command Line Interface (CLI) for RobotOps
Stars: ✭ 425 (+620.34%)
Mutual labels:  bluetooth, serial-ports
etherport-client
Client-side virtual serial port for Etherport. Used to implement firmata-compatible boards and relays.
Stars: ✭ 20 (-66.1%)
Mutual labels:  serial-ports
BLELib
This library contains many of the features you need to interact with BLE peripherals
Stars: ✭ 21 (-64.41%)
Mutual labels:  bluetooth
SimpleBLE
The ultimate fully-fledged cross-platform BLE library, designed for simplicity and ease of use.
Stars: ✭ 122 (+106.78%)
Mutual labels:  bluetooth
Low power TTGO T-beam
Low power consumption for TTGO t-beam
Stars: ✭ 45 (-23.73%)
Mutual labels:  bluetooth
ConsolePi
Raspberry Pi Based Serial Console Server, with PushBullet Notification of IP changes, Automatic VPN termination, custom menu, Power Outlet Control, and a lot more
Stars: ✭ 109 (+84.75%)
Mutual labels:  serial-ports
noise
A chat app for the end of the world.
Stars: ✭ 27 (-54.24%)
Mutual labels:  bluetooth
arduino-ble-gadget
Create your own Do-It-Yourself BLE enabled sensor gadget on the ESP32 platform.
Stars: ✭ 31 (-47.46%)
Mutual labels:  bluetooth
gobot
Golang framework for robotics, drones, and the Internet of Things (IoT)
Stars: ✭ 7,869 (+13237.29%)
Mutual labels:  bluetooth
radonreader
Read current radon level from RadonEye RD200
Stars: ✭ 46 (-22.03%)
Mutual labels:  bluetooth
rAudio-1
Raspberry Pi audio player: AirPlay, Audio CD, Bluetooth, DAB radio, DSP, Internet rafio, Multi-room, Spotify Connect, UPnP
Stars: ✭ 151 (+155.93%)
Mutual labels:  bluetooth
ios
CoThings's iOS application. CoThings is a realtime counter for shared things.
Stars: ✭ 13 (-77.97%)
Mutual labels:  bluetooth
Apple-Signal
Connect Apple devices via bluetooth and wifi.
Stars: ✭ 27 (-54.24%)
Mutual labels:  bluetooth
fix-linux-mouse
Hints how to fix USB mouse issues on Linux
Stars: ✭ 36 (-38.98%)
Mutual labels:  bluetooth
mikoto
Bluetooth LE nRF52840 microcontroller in a pro-micro footprint.
Stars: ✭ 139 (+135.59%)
Mutual labels:  bluetooth
BlueReverse
Bluetooth reverse shell.
Stars: ✭ 15 (-74.58%)
Mutual labels:  bluetooth
gnome-keysign
An easier way to sign OpenPGP keys over the local network. A GTK/GNOME application to use GnuPG for signing other peoples' keys. Quickly, easily, and securely.
Stars: ✭ 42 (-28.81%)
Mutual labels:  bluetooth
Echo
A simple iOS application redirects microphone input to the Bluetooth audio device
Stars: ✭ 33 (-44.07%)
Mutual labels:  bluetooth
BluetoothChat
☉‿⊙ Simple bluetooth chat app.
Stars: ✭ 96 (+62.71%)
Mutual labels:  bluetooth
H.E.L.P.
Home Environment Locating People 🍍
Stars: ✭ 19 (-67.8%)
Mutual labels:  bluetooth

Multiplatform Bluetooth serial port communication library

Based on Bluetooth serial port communication for Node.js

Prequisites on Linux

  • CMake
  • Needs Bluetooth development packages to build

apt-get install libbluetooth-dev cmake gcc-c++
zypper install bluez-devel cmake gcc-c++

Prequisites on OS X

  • CMake from MacPorts
  • Needs XCode and XCode command line tools installed.

Prequisites on Windows

  • CMake
  • Visual Studio

Documentation

Basic usage

#include <iostream>
#include <vector>
#include <memory>
#include "../src/DeviceINQ.h"

using namespace std;

void main()
{
	unique_ptr<DeviceINQ> inq(DeviceINQ::Create());
	vector<device> devices = inq->Inquire();

	for (const auto& d : devices)
	{
		cout << d.name << " " << d.address << endl;
	}

	cout << endl << "done, found " << devices.size() << " device(s)" << endl;
}

API

DeviceINQ

DeviceINQ::Create()

Returns new instance of DeviceINQ object

DeviceINQ::Inquire()

Returns list of bluetooth devices in range

struct device
{
	string address; // bluetooth address of the device
	string name; // name of the device
	time_t lastSeen; // last time device was seen in the inquiry (windows, osx)
	time_t lastUsed; // last time device was used (windows)
	bool connected; // true if device is connected (windows, osx)
	bool remembered; // true if device is remembered (windows, osx)
	bool authenticated; // true if device is authenticated (windows, osx)
	DeviceClass deviceClass; // class of device
	DeviceClass majorDeviceClass; // major class of device
	ServiceClass serviceClass; // service class flags
};

Note for Mac users: DeviceINQ relies on a separate executable named btScan built together with the library which has to be in the same directory as the library (the code searching for it is at the top of DeviceINQ::Inquire() and can be modified according to your needs). The reason for this is that IOBluetoothDeviceInquiry has the undocumented requirement that the RunLoop of the application's main thread be executed. While almost any GUI application will fulfill this requirement, a simple command line tool such as the bundled example won't. Since we can't just hijack the application's main thread, this is the only way to guarantee that the device search functions correctly.

DeviceINQ::SdpSearch(address)

Returns serial port channelID for device at given address

  • address: string containing bluetooth address of the device
Note: This method seems to fail on Windows, use value 1 for channelID instead

BTSerialPortBinding

BTSerialPortBinding::Create(address, channelID)

Returns new instance of BTSerialPortBinding object

  • address: string containint bluetooth address of the device
  • channelID: ID of the serial port channel
Note: channelID should be always 1 for serial port

BTSerialPortBinding::Connect()

Connects to the device, needs to be called before any Read/Write calls

BTSerialPortBinding::Close()

Closes connection to the device

BTSerialPortBinding::Read(buffer, length)

Reads data from the device, returns numbe rof bytes read

  • buffer: pointer to buffer to hold received data
  • length: maximum namber of bytes to read

BTSerialPortBinding::Write(buffer, length)

Writes data to the device

  • buffer: pointer to buffer with data to send
  • length: number of bytes to send

BTSerialPortBinding::IsDataAvailable()

Returns true if there is data in the buffer ready to be read (not implemented for OSX - always returns false)

Other

GetDeviceClassString(deviceClass)

Returns text representation of deviceClass enum value

GetServiceClassString(serviceClass)

Returns text representation of serviceClass enum value

LICENSE

This module is available under a FreeBSD license, see the LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].