Code Monkey home page Code Monkey logo

ble_serial's Introduction

BLE_Serial

Application for connecting Bluetooth LE devices to COM ports.

Supported platforms

  • Windows

Development requierements

  • CMake version 3.16 or newer.
  • MSVC compiler (may work on other compilers, untested)
  • UWP (on Windows)

Commands

ble_serial ls [timeout]

Description

Scans for BLE

Arguments

  • timeout - how long should the scan be running for (in seconds) [Default: 5 seconds] devices for timeout seconds and prints the results.

ble_serial query <device_addr> [timeout=5]

Description

Connects to a BLE device with the given address and queries it for all its services and characteristics.

Arguments

  • device_addr - address of the device that we are trying to connect to (can be obtained with ble_serial ls)
  • timeout - maximum time for estabilishing a connection with the device (in seconds) [Default: 5 seconds]

ble_serial connect <device_addr> <service_id> <characteristic_id> <com_port_number> [timeout] [baud] [data] [stop] [parity] [refresh_ms]

Description

Connects to a BLE device and subscribes to the characteristic with the given characteristic_id and binds it to a COM port and makes a bidirectional tunnel.

Any data written to the bound COM port will be written to the bound BLE characteristic.

After the bound characteristic changes the data will be written to the bound COM port.

Arguments

  • device_addr - address of the device that we are trying to connect to (can be obtained with ble_serial ls)
  • service_id - id of the service to be bound to the COM port
  • characteristic_id - id of the service to be bound to the COM port
  • com_port_number - number of a com port that will be used for binding
  • timeout - maximum time for estabilishing a connection with the device (in seconds) [Default: 5 seconds]
  • baud, data, stop, parity - COM port settings (baud rate, data bits, stop bits, parity bits) [Default: 8-N-1]
  • refresh_ms - every how many milliseconds should the COM port be refreshed [Default: 100 ms]

Library

The BLE_Serial can be used also as a C++ library for interfacing with BLE devices and COM ports.

How to use

This project uses CMake. You can use git submodules to directly add the project's source tree to your project.

Then you can link against BLE_Serial_Lib target in your project.

Example CMake file

cmake_minimum_required(VERSION 3.16)
project(MyProject CXX)

add_subdirectory("path_to_ble_serial_directory")

add_executable(MyExecutable
        src/main.cpp
)

target_link_libraries(BLE_Serial
        PUBLIC
            BLE_Serial_Lib
)

Example C++ aplication

For an example application use you can see the BLE_Serial app source code

Documentation

The library documentation can be found here

ble_serial's People

Contributors

that-apex avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ble_serial's Issues

Virtual COM port for HM-10 module?

This looks like what a lot of people have been looking for- creating a virtual COM port on Windows for BLE the same way as it works for regular Bluetooth. Would it work for HM-10? Also, is it possible to post a compiled executable?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.