Hook up power source enum
This commit is contained in:
@@ -8,28 +8,30 @@
|
|||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
#include "BSP.h"
|
||||||
|
#include "TipThermoModel.h"
|
||||||
#include "ble_peripheral.h"
|
#include "ble_peripheral.h"
|
||||||
#include "bluetooth.h"
|
#include "bluetooth.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
#include "gatt.h"
|
#include "gatt.h"
|
||||||
#include "hal_clock.h"
|
#include "hal_clock.h"
|
||||||
#include "hci_core.h"
|
#include "hci_core.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "uuid.h"
|
#include "uuid.h"
|
||||||
#include "configuration.h"
|
|
||||||
#include "BSP.h"
|
|
||||||
#include "TipThermoModel.h"
|
|
||||||
|
|
||||||
|
#include "USBPD.h"
|
||||||
#include "ble_characteristics.h"
|
#include "ble_characteristics.h"
|
||||||
#include "ble_handlers.h"
|
#include "ble_handlers.h"
|
||||||
|
#include "pd.h"
|
||||||
#include "power.hpp"
|
#include "power.hpp"
|
||||||
|
|
||||||
int ble_char_read_status_callback(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, u16_t len, u16_t offset) {
|
int ble_char_read_status_callback(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, u16_t len, u16_t offset) {
|
||||||
if (attr == NULL || attr->uuid == NULL) {
|
if (attr == NULL || attr->uuid == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint16_t uuid_value = ((struct bt_uuid_16 *)attr->uuid)->val;
|
uint16_t uuid_value = ((struct bt_uuid_16 *)attr->uuid)->val;
|
||||||
uint32_t temp=0;
|
uint32_t temp = 0;
|
||||||
switch (uuid_value) {
|
switch (uuid_value) {
|
||||||
case 1: // Live temp
|
case 1: // Live temp
|
||||||
{
|
{
|
||||||
@@ -37,7 +39,7 @@
|
|||||||
memcpy(buf, &temp, sizeof(temp));
|
memcpy(buf, &temp, sizeof(temp));
|
||||||
return sizeof(temp);
|
return sizeof(temp);
|
||||||
} break;
|
} break;
|
||||||
case 2://Setpoint temp
|
case 2: // Setpoint temp
|
||||||
temp = getSettingValue(SettingsOptions::SolderingTemp);
|
temp = getSettingValue(SettingsOptions::SolderingTemp);
|
||||||
memcpy(buf, &temp, sizeof(temp));
|
memcpy(buf, &temp, sizeof(temp));
|
||||||
return sizeof(temp);
|
return sizeof(temp);
|
||||||
@@ -57,21 +59,15 @@
|
|||||||
temp = X10WattsToPWM(x10WattHistory.average());
|
temp = X10WattsToPWM(x10WattHistory.average());
|
||||||
memcpy(buf, &temp, sizeof(temp));
|
memcpy(buf, &temp, sizeof(temp));
|
||||||
return sizeof(temp);
|
return sizeof(temp);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 6: // power src
|
case 6: // power src
|
||||||
// Todo return enum for current power source
|
// Todo return enum for current power source
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MSG("Unhandled attr read %d | %d\n", (uint32_t)attr->uuid, uuid_value);
|
MSG("Unhandled attr read %d | %d\n", (uint32_t)attr->uuid, uuid_value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
NAME
|
|
||||||
ble_tp_recv_wr(receive data from client)
|
|
||||||
*/
|
|
||||||
|
|
||||||
int ble_tp_recv_wr(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, u16_t len, u16_t offset, u8_t flags) {
|
int ble_tp_recv_wr(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, u16_t len, u16_t offset, u8_t flags) {
|
||||||
BT_WARN("recv data len=%d, offset=%d, flag=%d\n", len, offset, flags);
|
BT_WARN("recv data len=%d, offset=%d, flag=%d\n", len, offset, flags);
|
||||||
BT_WARN("recv data:%s\n", bt_hex(buf, len));
|
BT_WARN("recv data:%s\n", bt_hex(buf, len));
|
||||||
|
|||||||
Reference in New Issue
Block a user