Bluetooth-based Beacon technology pure dry goods tailored to their own exclusive Beacon
We don’t have an AltBeacon beacon yet, but we do have several Bluetooth development boards on hand. These boards are smart, microcontroller-based devices with built-in Bluetooth protocol stacks. Since they come equipped with a variety of peripheral interfaces and headers, they’re commonly used for prototyping. The firmware can be directly flashed onto the board or even integrated into a product for demonstration or testing purposes. I decided to build a Beacon application using the development boards I have and then test it with the Android Museum Guide app.
I’m using the Bluegiga DKBluetooth Low Energy Development Kit and the Intel Edison Development Board. The Bluegiga board is programmed using BGScript, a simple scripting language provided by Bluegiga. On the other hand, the Intel Edison runs Linux and offers multiple programming options. Since I'm more comfortable with Node.js and JavaScript, I chose to use it along with relevant Smart Bluetooth libraries.
**Turning Bluegiga into AltBeacon**
BGScript is easy to understand and comes with a rich set of functions from the Bluegiga framework. Creating an application with BGScript involves writing script files and configuration files using a text editor. Once written, the firmware can be directly uploaded to the board via USB using the Bluegiga SDK’s update tool.
The scripts include variable declarations, array definitions, and event handler callback functions. Callbacks play a crucial role in the programming model, as they are triggered when standard Bluegiga functions are called. Similarly, the framework can also invoke event handlers based on external events.
Implementing a Beacon on any platform requires working with the Generic Access Profile (GAP), which involves setting the content of the broadcast packet and configuring the broadcast parameters.
The elements of the Bluegiga AltBeacon implementation include:
Starting with variable declarations.

Figure 11 – Array declaration
The broadcast settings are handled in the `system_boot` event handler, which is called automatically after the board is powered on or reset. I first defined an array containing the Flags field, which consists of several bits indicating support for Bluetooth Smart and/or Bluetooth BR/EDR.
The data types included in the broadcast packet are known as ADV data types, and they are clearly defined in Part A of the Bluetooth Core Specification Addendum. Each data type has a single-byte length field and a single-byte data type field, as specified in the GAP numbering document.
Here is the first part of the initialization code:

Figure 12 – Define flags broadcast type in the system_boot event handler
In my previous article, I introduced the AltBeacon format and explained the data encoded in the GAP manufacturer-specific data field. I filled the last 20 bytes of the same array accordingly.

Figure 13 – Defining AltBeacon Data in Manufacturer-Specific Data Fields
Next, I set the device name for the Beacon, which will appear in the scan results from a central device like a smartphone. This value is another broadcast type, so I configured it separately. As shown, the local name was set to "AltBeacon."

Figure 14 – Creating a local name for the scan response
Configuring the broadcast parameters involved calling specific features and arrays from Bluegiga.

Figure 15 - Configuring GAP Broadcast
With that, my custom AltBeacon on the Bluegiga board was ready.

Figure 16 – AltBeacon on DKBLE
Another option: AltBeacon on Intel Edison
Node.js is modular and has a wide range of available modules, similar to libraries. The "Bleno" module provides functions for applications acting as Bluetooth GAP peripherals, such as defining and implementing GATT profiles. It's open source and created by Sandeep Mistry. He also developed the Noble module for creating software for GAP Central Mode devices. Both Bleno and Noble are available on GitHub.
While Bleno doesn't natively support AltBeacon, it does support iBeacon. To create AltBeacon, I forked the Noble repository and modified Bleno accordingly. Here's how I did it.
I added new features to the standard `bleno.js` file and then initiated the broadcast using a set of predefined parameters in the Node.js application. The new feature code looks like this:

Figure 17 – New features in bleno/lib/bleno.js
This code fills the necessary AltBeacon data into a buffer and calls other functions added to the `Linuxbindings.js` file. Bleno works with the BlueZ Bluetooth stack on Linux, and its functionality for multiple applications ultimately maps to calls for BlueZ functionality. I had to make changes to the Linux-related part of Bleno to support AltBeacon.

Figure 18 – New features in bleno/lib/linux/bindings.js

Figure 19 – New features in bleno/lib/linux/hci-ble.js
These features prepare a buffer similar to the one on the Bluegiga board, containing all the necessary broadcast data, and then pass it through the Bleno API layer to the BlueZ Host Controller Interface (HCI).
**AltBeacon Node.js App**
After modifying Bleno to support AltBeacon, the next step was to create a Node.js application using the updated Bleno module and start broadcasting in AltBeacon format. The entire application consisted of just seven lines of code, as shown below.

Figure 20 – AltBeacon node.js application
To run the AltBeacon app, I used Putty to establish a terminal session with the Intel Edison via SSH or Telnet, then executed `node app.js` from the command line.

Figure 21 – Putty establishes a terminal dialogue
Pp-Pe Film Pelletizing Line,Pelletizing Line For Pp-Pe Film,Pp-Pe Film Recycling Machine, Film Granulator For Pp-Pe
Zhejiang IET Intelligent Equipment Manufacturing Co.,Ltd , https://www.ietmachinery.com