Red Amber Linux Tutorial

Contents

Overview

The GemSDK for Linux supports almost all distributions based on Linux kernel 2.6+ (where BlueZ kernel-space modules are included).
The GemSDK API is the same as Windows, therefore you can use the code samples from the Windows Tutorial’s “Getting Started” section and Window’s reference API can be used as well. This document will guide through setting up the GemSDK and run it in a Linux environment.

GemSDK features:

GemSDK provides you with a Shared Object library (GemSDK.so) which has a C-interface and therefore can be used easily with any language supporting C bindings.

Installation

Requirements

Launching an app compiled with GemSDK

Since GemSDK needs exclusive control over the BLE controller, we will need to turn it so user-space libraries won’t interfere. You can check whether the device is down by executing “hciconfig” in the terminal, then checking the following line in the output:

hci0: Type: Primary Bus: USB
BD Address: 5C:F3:70:76:C2:48 ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING
RX bytes:2246 acl:0 sco:0 events:221 errors:0
TX bytes:37678 acl:0 sco:0 commands:220 errors:0

If it says anything but DOWN, you will need to run the command “sudo hciconfig hci0 down”, and then run “hciconfig” again and the output should look like this:

hci0: Type: Primary Bus: USB
BD Address: 5C:F3:70:76:C2:48 ACL MTU: 1021:8 SCO MTU: 64:1
DOWN
RX bytes:2246 acl:0 sco:0 events:221 errors:0
TX bytes:37678 acl:0 sco:0 commands:220 errors:0

The app will also require cap_net_admin and cap_net_raw permissions for taking exclusive control over this BLE controller. This can be given to the app with the following command “sudo setcap cap_net_admin,cap_net_raw+eip app_name” (change app_name) to your compiled binary name.

Now you should be able to run the app.