Changes after PR review.

CSC profile specific ATT error added.
Custom endianness handling functions replaced with system functions.
Device appearance moved to syscfg.

X-Original-Commit: 6cb978b99b2014a9589b1d59ea40e17a9e531dfd
This commit is contained in:
Maciej Jurczak
2018-02-19 23:18:24 +01:00
parent ceab2b4609
commit b0e6640b4d
3 changed files with 35 additions and 14 deletions
@@ -33,12 +33,13 @@ struct ble_hs_cfg;
#define BLE_SVC_GAP_CHR_UUID16_RECONNECT_ADDR 0x2a03
#define BLE_SVC_GAP_CHR_UUID16_PERIPH_PREF_CONN_PARAMS 0x2a04
#define BLE_SVC_GAP_APPEARANCE_GEN_COMPUTER 128
#define BLE_SVC_GAP_APPEARANCE_GEN_UNKNOWN 0
#define BLE_SVC_GAP_APPEARANCE_GEN_COMPUTER 128
#define BLE_SVC_GAP_APPEARANCE_CYC_SPEED_AND_CADENCE_SENSOR 1157
const char *ble_svc_gap_device_name(void);
int ble_svc_gap_device_name_set(const char *name);
int ble_svc_gap_device_appearance(void);
int ble_svc_gap_device_appearance_set(const uint16_t appearance);
uint16_t ble_svc_gap_device_appearance(void);
void ble_svc_gap_init(void);
+7 -11
View File
@@ -23,12 +23,16 @@
#include "sysinit/sysinit.h"
#include "host/ble_hs.h"
#include "services/gap/ble_svc_gap.h"
#include "os/endian.h"
/* XXX: This should be configurable. */
#define BLE_SVC_GAP_NAME_MAX_LEN 31
static char ble_svc_gap_name[BLE_SVC_GAP_NAME_MAX_LEN + 1] = "nimble";
static uint16_t ble_svc_gap_appearance;
static const uint8_t ble_svc_gap_appearance[2] = {
(MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE)) & 0xFF,
((MYNEWT_VAL(BLE_SVC_GAP_APPEARANCE)) >> 8) & 0xFF
};
static uint8_t ble_svc_gap_privacy_flag;
static uint8_t ble_svc_gap_reconnect_addr[6];
static uint8_t ble_svc_gap_pref_conn_params[8];
@@ -150,18 +154,10 @@ ble_svc_gap_device_name_set(const char *name)
return 0;
}
int
uint16_t
ble_svc_gap_device_appearance(void)
{
return ble_svc_gap_appearance;
}
int
ble_svc_gap_device_appearance_set(const uint16_t appearance)
{
ble_svc_gap_appearance = appearance;
return 0;
return get_le16(ble_svc_gap_appearance);
}
void
+24
View File
@@ -0,0 +1,24 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Package: net/nimble/host/services/gap
syscfg.defs:
BLE_SVC_GAP_APPEARANCE:
description: 'Device appearance'
value: 0