GithubHelp home page GithubHelp logo

m4444x / ble-scanner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from davidgyoung/ble-scanner

0.0 0.0 0.0 11 KB

Bluetooth LE scanning CLI tool for Linux/BlueZ

License: BSD 3-Clause "New" or "Revised" License

C 100.00%

ble-scanner's Introduction

BLE Scanner

A command line utility for Bluetooth LE scanning on Linux / BlueZ

Compiling

  1. Install prerequisites

sudo apt-get install libbluetooth-dev

  1. Compile the program

cc scanner.c -lbluetooth -o scanner

Running

Run the program like this:

./scanner

Each time it detects a Bluetooth LE advertisement it prints out the MAC address of the advertisting device, the RSSI and the bytes of the advertisement like this:

B8:27:EB:1F:93:4D -68 02 01 06 11 06 82 75 25 D9 37 9D D7 8F 5F 4A F4 20 00 00 75 30
71:5C:23:9D:BC:7F -68 02 01 1A 02 0A 0C 0B FF 4C 00 10 06 03 1A 3B D4 B2 EB
B8:27:EB:1F:93:4D -68 02 01 06 11 06 82 75 25 D9 37 9D D7 8F 5F 4A F4 20 00 00 75 30

In the first line above, B8:27:EB:1F:93:4D is the hardware MAC address, -68 is the RSSI and the remaining values are the hex bytes of the advertisement.

The program will auto exit after one of two things happens: (a) 10 seconds pass with no detections. (b) 1000 advertisements are detected. It does this for the sake of stability. Rarely, the underlying bluetooth stack will crash. By exiting after 10 seconds it allows you to restart the program and get new detections. Running forever is actually less stable.

Need Help? Want to change this?

Feel free to open an Issue or submit a Pull Request on Github here: https://github.com/davidgyoung/ble-scanner

License

BSD 3

Credits

This program is based off of code by Damian Kołakowski here https://github.com/damian-kolakowski/intel-edison-playground/blob/master/scan.c

ble-scanner's People

Contributors

davidgyoung avatar m4444x avatar

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.