bluetooth project compilation error: 'client' was not declared in this scope

Hey guys,

Im using Adafruit’s Bluetooth Low Energy (BLE 4.0) nRF8001 Breakout board to establish a connection between my Arduino and Android device.

My arduino code is below:

#include <Adafruit_BLE_UART.h>

#include <SPI.h>

#include <aREST.h>

// Libraries
// Pins
#define ADAFRUITBLE_RDY 2 // This should be an interrupt pin, on Uno thats #2 or #3

// Relay pin
const int relay_pin = 7;

// Create aREST instance
aREST rest = aREST();

// BLE instance

void setup() {
// put your setup code here, to run once:



pinMode(relay_pin, OUTPUT);


void loop() {
// Tell the nRF8001 to do whatever it should be working on.

// Ask what is our current status
aci_evt_opcode_t status = BTLEserial.getState();

// Handle REST calls
if (status == ACI_EVT_CONNECTED) {


As you can see, Im using Adafruit’s library for this particular chip along with a REST api library.

However, im receiving this error message (below) whenever I try to compile the project :

In file included from bluetoothArduino.ino:5:0:
C:\Users\Gokul\Documents\Arduino\libraries\aREST-master/aREST.h: In member function ‘void aREST::publish(Adafruit_BLE_UART&, String, T)’:
C:\Users\Gokul\Documents\Arduino\libraries\aREST-master/aREST.h:369:17: error: ‘client’ was not declared in this scope
publish_proto(client, eventName, value);
Error compiling.

Im new to the arduino and am unsure about what is causing this error. Any advice would be much appreciated!

Thanks in advance!

The error message says the error is in the aREST.h file. So how about showing us the library you’re using so we can actually see where the error is.

Hi Delta_G!

Thanks for offering to help! Here is the github link for the library im using :

#elif defined(_ADAFRUIT_BLE_UART_H_)
void handle(Adafruit_BLE_UART& serial) {

  if (serial.available()) {

    // Handle request

    // Answer

    // Reset variables for the next command

template <typename T>
void publish(Adafruit_BLE_UART& serial, String eventName, T value) {

  // Publish request
  publish_proto(client, eventName, value);


Someone didn’t test that library very thoroughly. Clearly, you have ADAFRUIT_BLE_UART_H defined, or the compiler wouldn’t even be trying to use that particular publish() function.

In that function, it seems that serial is the object to be passed to publish_proto(). In all the other blocks, the argument to publish() is called client.

Thanks for the reply PaulS!

So would this mean I can't use this library? Or is there some way to work around this issue ?

So would this mean I can't use this library?

If you can't use an editor, I'm afraid that you will need different hardware in order to be able to use the library as-is.

Or is there some way to work around this issue ?

Fire up a text editor, and change client to serial in the publish_proto() call in the block that deals with your hardware.

You should also report the problem to Adafruit.

Thanks PaulS! I made your suggested changes and it compiled fine!

Cheers :)