Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
hung-eoh committed Dec 23, 2024
1 parent f7c6483 commit c7a34b3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/BLE/ERaBLETranspArduino.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ERaBLETransp
const char* TAG = "BLETransp";

public:
ERaBLETransp(ERaCallbacksHelper& helper,
ERaBLETransp(ERaCallbackSetter& setter,
bool base64 = false,
bool encrypt = true)
: ERaEncryptBearSSL(base64)
Expand All @@ -51,7 +51,7 @@ class ERaBLETransp
, mCharacteristicAUT(NULL)
, mCharacteristicCTR(NULL)
{
helper.setERaTransp(this);
setter.setERaTransp(this);
ERaBLETransp::instance() = this;
}
~ERaBLETransp()
Expand Down
10 changes: 5 additions & 5 deletions src/BLE/ERaBLETranspEsp32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ERaBLETransp
const char* TAG = "BLETransp";

public:
ERaBLETransp(ERaCallbacksHelper& helper,
ERaBLETransp(ERaCallbackSetter& setter,
bool base64 = false,
bool encrypt = true)
: ERaEncryptMbedTLS(base64)
Expand All @@ -56,7 +56,7 @@ class ERaBLETransp
, mCharacteristicAUT(NULL)
, mCharacteristicCTR(NULL)
{
helper.setERaTransp(this);
setter.setERaTransp(this);
ERaBLETransp::instance() = this;
}
~ERaBLETransp()
Expand Down Expand Up @@ -107,10 +107,10 @@ class ERaBLETransp
return;
}

if (BLEDevice::getInitialized()) {
BLEDevice::deinit();
if (!BLEDevice::getInitialized()) {
/* BLEDevice::deinit(); */
BLEDevice::init(this->getDeviceName());
}
BLEDevice::init(this->getDeviceName());

this->mServer = BLEDevice::createServer();
this->mServer->setCallbacks(this);
Expand Down
10 changes: 8 additions & 2 deletions src/BLE/ERaBLETranspRealtek.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ERaBLETransp
const char* TAG = "BLETransp";

public:
ERaBLETransp(ERaCallbacksHelper& helper,
ERaBLETransp(ERaCallbackSetter& setter,
bool base64 = false,
bool encrypt = true)
: ERaEncryptMbedTLS(base64)
Expand All @@ -53,7 +53,7 @@ class ERaBLETransp
, mScanData(NULL)
, mBleTask(NULL)
{
helper.setERaTransp(this);
setter.setERaTransp(this);
ERaBLETransp::instance() = this;
}
~ERaBLETransp()
Expand Down Expand Up @@ -106,6 +106,10 @@ class ERaBLETransp
this->mAdvertData->clear();
this->mAdvertData->addFlags(GAP_ADTYPE_FLAGS_LIMITED | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED);
this->mAdvertData->addCompleteName(this->getDeviceName());
if (this->isNewService()) {
this->mAdvertData->addCompleteServices(BLEUUID(this->mTranspProp->address));
}
this->mAdvertData->addCompleteServices(BLEUUID(SERVICE_UUID));

if (this->mInitialized) {
BLE.configAdvert()->setAdvData(*this->mAdvertData);
Expand Down Expand Up @@ -165,6 +169,8 @@ class ERaBLETransp
BLE.init();
BLE.configAdvert()->setAdvData(*this->mAdvertData);
BLE.configAdvert()->setScanRspData(*this->mScanData);
BLE.configSecurity()->setPairable(true);
BLE.configSecurity()->setAuthFlags(GAP_AUTHEN_BIT_BONDING_FLAG);
if (this->isNewService()) {
BLE.configServer(2);
BLE.addService(*this->mNewService);
Expand Down
10 changes: 5 additions & 5 deletions src/BLE/ERaNimBLETransp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ERaBLETransp
const char* TAG = "BLETransp";

public:
ERaBLETransp(ERaCallbacksHelper& helper,
ERaBLETransp(ERaCallbackSetter& setter,
bool base64 = false,
bool encrypt = true)
: ERaEncryptMbedTLS(base64)
Expand All @@ -55,7 +55,7 @@ class ERaBLETransp
, mCharacteristicAUT(NULL)
, mCharacteristicCTR(NULL)
{
helper.setERaTransp(this);
setter.setERaTransp(this);
ERaBLETransp::instance() = this;
}
~ERaBLETransp()
Expand Down Expand Up @@ -106,10 +106,10 @@ class ERaBLETransp
return;
}

if (NimBLEDevice::getInitialized()) {
NimBLEDevice::deinit();
if (!NimBLEDevice::getInitialized()) {
/* NimBLEDevice::deinit(); */
NimBLEDevice::init(this->getDeviceName());
}
NimBLEDevice::init(this->getDeviceName());

this->mServer = NimBLEDevice::createServer();
this->mServer->setCallbacks(this);
Expand Down
13 changes: 8 additions & 5 deletions src/BLE/ERaSerialBLETransp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ERaBLETransp
const char* TAG = "BLETransp";

public:
ERaBLETransp(ERaCallbacksHelper& helper,
ERaBLETransp(ERaCallbackSetter& setter,
Stream& stream)
: mStream(stream)
, mTranspProp(ERaBluetooth::instance())
Expand All @@ -28,7 +28,7 @@ class ERaBLETransp
, mBleTask(NULL)
#endif
{
helper.setERaTransp(this);
setter.setERaTransp(this);
ERaBLETransp::instance() = this;
}
~ERaBLETransp()
Expand Down Expand Up @@ -69,11 +69,14 @@ class ERaBLETransp
#if !defined(ERA_MCU_CORE)
#define ERA_MCU_CORE 0
#endif
#if !defined(ERA_BLE_TASK_SIZE)
#define ERA_BLE_TASK_SIZE (1024 * 5)
#endif
#if !defined(ERA_BLE_TASK_PRIORITY)
#define ERA_BLE_TASK_PRIORITY (configMAX_PRIORITIES - 4)
#endif
this->mBleTask = ERaOs::osThreadNew(this->bleTask, "bleTask", 1024 * 5, this,
ERA_BLE_TASK_PRIORITY, ERA_MCU_CORE);
this->mBleTask = ERaOs::osThreadNew(this->bleTask, "bleTask", ERA_BLE_TASK_SIZE,
this, ERA_BLE_TASK_PRIORITY, ERA_MCU_CORE);
#endif
this->mConnected = true;
this->mInitialized = true;
Expand Down Expand Up @@ -138,7 +141,7 @@ class ERaBLETransp
}
*begin++ = (uint8_t)c;
}
return begin - buf;
return ((int)(begin - buf));
}

int timedRead() {
Expand Down

0 comments on commit c7a34b3

Please sign in to comment.