Minor Syntax correction
Tabulation indentation fixed after last commit changes and other minor changes in comments
This commit is contained in:
parent
24dce9ac6a
commit
fe3412b289
|
|
@ -33,15 +33,18 @@ struct DefaultSettingsClient : public BLEMIDI_NAMESPACE::DefaultSettings
|
||||||
/*
|
/*
|
||||||
##### BLE DEVICE NAME #####
|
##### BLE DEVICE NAME #####
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set name of ble device (not affect to connection with server)
|
* Set name of ble device (not affect to connection with server)
|
||||||
* max 16 characters
|
* max 16 characters
|
||||||
*/
|
*/
|
||||||
static constexpr char *name = "BleMidiClient";
|
static constexpr char *name = "BleMidiClient";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
###### TX POWER #####
|
###### TX POWER #####
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set power transmision
|
* Set power transmision
|
||||||
*
|
*
|
||||||
|
|
@ -56,9 +59,11 @@ struct DefaultSettingsClient : public BLEMIDI_NAMESPACE::DefaultSettings
|
||||||
*/
|
*/
|
||||||
static const esp_power_level_t clientTXPwr = ESP_PWR_LVL_P9;
|
static const esp_power_level_t clientTXPwr = ESP_PWR_LVL_P9;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
###### SECURITY #####
|
###### SECURITY #####
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Set the IO capabilities of the device, each option will trigger a different pairing method.
|
/** Set the IO capabilities of the device, each option will trigger a different pairing method.
|
||||||
* BLE_HS_IO_KEYBOARD_ONLY - Passkey pairing
|
* BLE_HS_IO_KEYBOARD_ONLY - Passkey pairing
|
||||||
* BLE_HS_IO_DISPLAY_YESNO - Numeric comparison pairing
|
* BLE_HS_IO_DISPLAY_YESNO - Numeric comparison pairing
|
||||||
|
|
@ -83,9 +88,11 @@ struct DefaultSettingsClient : public BLEMIDI_NAMESPACE::DefaultSettings
|
||||||
*/
|
*/
|
||||||
static constexpr PasskeyRequestCallback userOnPassKeyRequest = defautlPasskeyRequest;
|
static constexpr PasskeyRequestCallback userOnPassKeyRequest = defautlPasskeyRequest;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
###### BLE COMMUNICATION PARAMS ######
|
###### BLE COMMUNICATION PARAMS ######
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Set connection parameters:
|
/** Set connection parameters:
|
||||||
* If you only use one connection, put recomended BLE server param communication
|
* If you only use one connection, put recomended BLE server param communication
|
||||||
* (you may scan it ussing "nRF Connect" app or other similar apps).
|
* (you may scan it ussing "nRF Connect" app or other similar apps).
|
||||||
|
|
@ -104,6 +111,7 @@ struct DefaultSettingsClient : public BLEMIDI_NAMESPACE::DefaultSettings
|
||||||
static const uint16_t commLatency = 0; //
|
static const uint16_t commLatency = 0; //
|
||||||
static const uint16_t commTimeOut = 200; // 2000ms
|
static const uint16_t commTimeOut = 200; // 2000ms
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
###### BLE FORCE NEW CONNECTION ######
|
###### BLE FORCE NEW CONNECTION ######
|
||||||
*/
|
*/
|
||||||
|
|
@ -118,7 +126,6 @@ struct DefaultSettingsClient : public BLEMIDI_NAMESPACE::DefaultSettings
|
||||||
static const bool forceNewConnection = false;
|
static const bool forceNewConnection = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Define a class to handle the callbacks when advertisments are received */
|
/** Define a class to handle the callbacks when advertisments are received */
|
||||||
class AdvertisedDeviceCallbacks : public NimBLEAdvertisedDeviceCallbacks
|
class AdvertisedDeviceCallbacks : public NimBLEAdvertisedDeviceCallbacks
|
||||||
{
|
{
|
||||||
|
|
@ -346,24 +353,23 @@ bool BLEMIDI_Client_ESP32<_Settings>::begin(const char *deviceName, BLEMIDI_Tran
|
||||||
_bleMidiTransport = bleMidiTransport;
|
_bleMidiTransport = bleMidiTransport;
|
||||||
|
|
||||||
std::string strDeviceName(deviceName);
|
std::string strDeviceName(deviceName);
|
||||||
if (strDeviceName == "") // Connect to the first midi server found
|
// Connect to the first midi server found
|
||||||
|
if (strDeviceName == "")
|
||||||
{
|
{
|
||||||
myAdvCB.specificTarget = false;
|
myAdvCB.specificTarget = false;
|
||||||
myAdvCB.nameTarget = "";
|
myAdvCB.nameTarget = "";
|
||||||
}
|
}
|
||||||
else // Connect to a specific name or address
|
// Connect to a specific name or address
|
||||||
|
else
|
||||||
{
|
{
|
||||||
myAdvCB.specificTarget = true;
|
myAdvCB.specificTarget = true;
|
||||||
myAdvCB.nameTarget = strDeviceName;
|
myAdvCB.nameTarget = strDeviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char array[16] = "patata";
|
static char array[16];
|
||||||
|
|
||||||
memcpy(array, _Settings::name, 16);
|
memcpy(array, _Settings::name, 16);
|
||||||
strDeviceName = array;
|
strDeviceName = array;
|
||||||
|
|
||||||
DEBUGCLIENT(strDeviceName.c_str());
|
DEBUGCLIENT(strDeviceName.c_str());
|
||||||
|
|
||||||
NimBLEDevice::init(strDeviceName);
|
NimBLEDevice::init(strDeviceName);
|
||||||
|
|
||||||
// To communicate between the 2 cores.
|
// To communicate between the 2 cores.
|
||||||
|
|
@ -390,7 +396,8 @@ bool BLEMIDI_Client_ESP32<_Settings>::available(byte *pvBuffer)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_client == nullptr || !_client->isConnected()) // Try to connect/reconnect
|
// Try to connect/reconnect
|
||||||
|
if (_client == nullptr || !_client->isConnected())
|
||||||
{
|
{
|
||||||
if (myAdvCB.doConnect)
|
if (myAdvCB.doConnect)
|
||||||
{
|
{
|
||||||
|
|
@ -481,7 +488,6 @@ if (!_Settings::forceNewConnection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (NimBLEDevice::getClientListSize() >= NIMBLE_MAX_CONNECTIONS)
|
if (NimBLEDevice::getClientListSize() >= NIMBLE_MAX_CONNECTIONS)
|
||||||
{
|
{
|
||||||
DEBUGCLIENT("Max clients reached - no more connections available");
|
DEBUGCLIENT("Max clients reached - no more connections available");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue