Skip to content

Commit

Permalink
Merge pull request #123 from senseshift/hotfix/bhaptics-quest-3-0.7.0
Browse files Browse the repository at this point in the history
fix(bHaptics): connect to Quest 3 on 0.7.0
  • Loading branch information
leon0399 authored Jul 2, 2024
2 parents 1424086 + 352378b commit 5b419e7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ on:
branches:
- master
- develop
- support/*
paths-ignore:
- "**/*.md"
push:
branches:
- master
- develop
- support/*
paths-ignore:
- "**/*.md"

Expand Down
54 changes: 41 additions & 13 deletions lib/bhaptics_ble/senseshift/bh/ble/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ namespace SenseShift::BH::BLE {
this->bleServer->getAdvertising()->setAppearance(this->config.appearance);
this->bleServer->getAdvertising()->setScanResponseData(*scanResponseData);

// Each characteristic needs 2 handles and descriptor 1 handle.
// Each characteristic needs 2 handles and descriptor 1 handle.
#if defined(SS_BLE_USE_NIMBLE) && SS_BLE_USE_NIMBLE == true
this->motorService = this->bleServer->createService(BH_BLE_SERVICE_MOTOR_UUID);
#else
this->motorService = this->bleServer->createService(BH_BLE_SERVICE_MOTOR_UUID, 30, 0);
#endif

{
MotorCharCallbacks* motorCallbacks = new MotorCharCallbacks(this->motorHandler);
Expand All @@ -162,6 +166,14 @@ namespace SenseShift::BH::BLE {
PROPERTY_READ | PROPERTY_WRITE
);
configChar->setCallbacks(new ConfigCharCallbacks());

uint8_t config[3] = {
0, // byte 0 - ?
0, // byte 1 - ?
0, // byte 2 - color,
// but for tactosy it is switching left/right position
};
configChar->setValue(config, 3);
}

{
Expand Down Expand Up @@ -213,16 +225,34 @@ namespace SenseShift::BH::BLE {
monitorChar->addDescriptor(new BLE2902());
#endif

uint16_t audioCableState = NO_AUDIO_CABLE;
monitorChar->setValue(audioCableState);
// bit 7 - audio jack (0: off, 1: on)
uint8_t status = 0b00000000;

uint8_t value[1] = { status };
monitorChar->setValue(value, 1);
}

// auto* athGlobalChar = this->motorService->createCharacteristic(
// BH_BLE_SERVICE_MOTOR_CHAR_ATH_GLOBAL_CONF_UUID,
// PROPERTY_READ | PROPERTY_WRITE | PROPERTY_NOTIFY | PROPERTY_BROADCAST | PROPERTY_INDICATE |
// PROPERTY_WRITE_NR
// );
// athGlobalChar->setCallbacks(new LogOutputCharCallbacks());
{
auto* athGlobalChar = this->motorService->createCharacteristic(
BH_BLE_SERVICE_MOTOR_CHAR_ATH_GLOBAL_CONF_UUID,
PROPERTY_READ | PROPERTY_WRITE
);
athGlobalChar->setCallbacks(new LogOutputCharCallbacks());

uint8_t athGlobalConfig[20] = {
0, // byte 0 - ?
0, // byte 1 - VSM
0, // byte 2 - AthConfigIndex
0, // byte 3 - AthConfigIndex
0, // byte 4 - SignaturePatternOnOff (0: off, 1: on)
0, // byte 5 - WaitMinutes
0, // byte 6 - DisableEmbedAth (0: off, 1: on)
0, // byte 7 - ButtonLock (0: off, 1: on)
0, // byte 8 - LedInfo
};

athGlobalChar->setValue(athGlobalConfig, 20);
}

// auto* athThemeChar = this->motorService->createCharacteristic(
// BH_BLE_SERVICE_MOTOR_CHAR_ATH_THEME_UUID,
Expand Down Expand Up @@ -250,10 +280,8 @@ namespace SenseShift::BH::BLE {
{
auto dfuService = this->bleServer->createService(BH_BLE_SERVICE_DFU_UUID);

auto* dfuControlChar = dfuService->createCharacteristic(
BH_BLE_SERVICE_MOTOR_CHAR_SIGNATURE_PATTERN_UUID,
PROPERTY_READ | PROPERTY_WRITE
);
auto* dfuControlChar =
dfuService->createCharacteristic(BH_BLE_SERVICE_DFU_CHAR_CONTROL_UUID, PROPERTY_READ | PROPERTY_WRITE);
dfuService->start();
}

Expand Down

0 comments on commit 5b419e7

Please sign in to comment.