Skip to content

Commit

Permalink
GATT: answer to version request
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoquesada committed Jan 6, 2024
1 parent 9736bd1 commit b0c53ea
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/components/bluepad32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ set(srcs
"uni_log.c"
"uni_property.c"
"uni_utils.c"
"uni_version.c"
"uni_virtual_device.c")

if(CONFIG_IDF_TARGET_ESP32 OR PICO_SDK_VERSION_STRING OR BLUEPAD32_TARGET_LINUX)
Expand Down
28 changes: 25 additions & 3 deletions src/components/bluepad32/bt/uni_bt_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "bt/uni_bt_service.gatt.h"
#include "uni_common.h"
#include "uni_log.h"
#include "uni_version.h"

static int att_write_callback(hci_con_handle_t con_handle,
uint16_t att_handle,
Expand Down Expand Up @@ -80,14 +81,35 @@ static uint16_t att_read_callback(hci_con_handle_t connection_handle,
logi("att_read_callback handle: %#x\n", att_handle);
switch (att_handle) {
case ATT_CHARACTERISTIC_4627C4A4_AC01_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
// Commands
// version
return att_read_callback_handle_blob((const uint8_t*)uni_version, (uint16_t)strlen(uni_version), offset,
buffer, buffer_size);
break;
case ATT_CHARACTERISTIC_4627C4A4_AC02_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
// Properties
break;
case ATT_CHARACTERISTIC_4627C4A4_AC03_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
// Testing
break;
case ATT_CHARACTERISTIC_4627C4A4_AC04_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
break;
case ATT_CHARACTERISTIC_4627C4A4_AC05_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
break;
case ATT_CHARACTERISTIC_4627C4A4_AC06_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
break;
case ATT_CHARACTERISTIC_4627C4A4_AC07_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
break;
case ATT_CHARACTERISTIC_4627C4A4_AC08_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
break;
case ATT_CHARACTERISTIC_4627C4A4_AC09_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
break;
case ATT_CHARACTERISTIC_4627C4A4_AC0A_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
break;
case ATT_CHARACTERISTIC_4627C4A4_AC0B_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
break;
case ATT_CHARACTERISTIC_4627C4A4_AC0C_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
break;
case ATT_CHARACTERISTIC_4627C4A4_AC0D_46B9_B688_AFC5C1BF7F63_01_VALUE_HANDLE:
break;

case ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_BATTERY_LEVEL_01_VALUE_HANDLE:
break;
case ATT_CHARACTERISTIC_ORG_BLUETOOTH_CHARACTERISTIC_BATTERY_LEVEL_01_CLIENT_CONFIGURATION_HANDLE:
Expand Down
4 changes: 2 additions & 2 deletions src/components/bluepad32/include/uni_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#ifndef UNI_VERSION_H
#define UNI_VERSION_H

#include "sdkconfig.h"

#define UNI_VERSION "3.99.0"

extern const char* uni_version;

#endif // UNI_VERSION_H
7 changes: 7 additions & 0 deletions src/components/bluepad32/uni_version.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Ricardo Quesada
// http://retro.moe/unijoysticle2

#include "uni_version.h"

const char* uni_version = UNI_VERSION;

0 comments on commit b0c53ea

Please sign in to comment.