Skip to main content

bgapi_py

A library for using Bluetooth Low Energy modules created by BlueGiga. This module is pure python usable from Windows, Ubuntu, and any platform with a serial port and the ability to run Python (like Raspberry Pi and Beaglebone Black). Examples are provided for both client and server functionality. Note that if you want to develop your own device GATT profile, it requires a module firmware update.

bgapi.py has two important components:

  1. BlueGigaAPI wraps the serial connection, it can be used synchronously by calling the polling function, or it can be used asynchronously by starting the daemon thread.

  2. BlueGigaCallbacks is a base class for callbacks from responses and events received from the module. Inherit this class and override the functions you need to trigger your code or get your data.

cmd_def.py eliminates the need for magic numbers in method parameters, use it for more readable code.

bgmodule.py wraps the API in an additional layer of abstraction. It attempts to

eliminate the need to understand the BlueGiga API, so that only an understanding of BLE is required.

Example Code

The test folder demonstrates high level Bluetooth Smart operations. It provides examples of Apple’s iBeacon and Google’s prototype Physical Web. Testing of this library is limited to what you see in these examples. Many BGAPI commands cannot be tested, especially hardware operations like GPIO and I2C. Two BLE112 devices are needed for all tests.

Release files for bgapi 0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bgapi 0.7
File Size Uploaded
bgapi-0.7.tar.gz 21.0 kB Details

Release files / bgapi-0.7.tar.gz

Download URL bgapi-0.7.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
818ead9c2e6bc639b7bf31a1f4082cb222372da37792855e38f98ee786f1028f
BLAKE2b-256 checksum
How to use checksums
b3cd7a2ba4f827ad20a5cc206b003107caa80137ef974b9e50882ef9cf031192
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.7 This release

1 release file

0.6

1 release file

0.5.2

1 release file

0.5

1 release file

0.4

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page