You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pkarashchenko (via GitHub)" <gi...@apache.org> on 2023/06/22 20:36:15 UTC

[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1800: nimble: various improvements for nimble intergartion

pkarashchenko commented on code in PR #1800:
URL: https://github.com/apache/nuttx-apps/pull/1800#discussion_r1239004228


##########
wireless/bluetooth/nimble/Kconfig:
##########
@@ -7,13 +7,221 @@ config NIMBLE
 		host-layer stack.
 
 if NIMBLE
-config NIMBLE_STACKSIZE
-	int "nimble stack size"
-	default DEFAULT_TASK_STACKSIZE
 
 config NIMBLE_REF
 	string "Version"
 	default "bc7828341226d860429c63994065f8f1b8b8d7b0"
 	---help---
 		Git ref name to use when downloading from nimBLE repo
-endif
+
+if DEBUG_FEATURES
+
+config NIMBLE_DEBUG_ERROR
+	bool "Apache nimBLE error output"
+	default n
+	depends on DEBUG_ERROR
+
+config NIMBLE_DEBUG_WARN
+	bool "Apache nimBLE warnings output"
+	default n
+	depends on DEBUG_ERROR
+
+config NIMBLE_DEBUG_INFO
+	bool "Apache nimBLE informational debug output"
+	default n
+	depends on DEBUG_INFO
+
+endif # DEBUG_FEATURES
+
+config NIMBLE_TINYCRYPT
+	bool "Apache nimBLE tinycrypt support"
+	default y
+
+config NIMBLE_MESH
+	bool "Apache nimBLE mesh support"
+	default n
+	depends on EXPERIMENTAL
+
+menu "NimBLE role configuration"
+
+config NIMBLE_ROLE_BROADCASTER
+	bool "nimBLE broadcaster role"
+	default n
+
+config NIMBLE_ROLE_CENTRAL
+	bool "nimBLE central role"
+	default n
+
+config NIMBLE_ROLE_OBSERVER
+	bool "nimBLE observer role"
+	default n
+
+config NIMBLE_ROLE_PERIPHERAL
+	bool "nimBLE peripheral role"
+	default n
+
+endmenu # "NimBLE role configuration"
+
+choice
+	prompt "NimBLE BLE version"
+	default NIMBLE_BLE_VERSION_50
+
+config NIMBLE_BLE_VERSION_50
+	bool "NimBLE BLE version 5.0"

Review Comment:
   Can we use `nimBLE` or `NimBLE` in all the places?



##########
examples/nimble/nimble_main.c:
##########
@@ -0,0 +1,322 @@
+/****************************************************************************
+ * apps/examples/nimble/nimble_main.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <sys/boardctl.h>
+#include <assert.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "netutils/netinit.h"
+
+#include "nimble/nimble_npl.h"
+#include "nimble/nimble_port.h"
+
+#include "host/ble_hs.h"
+#include "host/util/util.h"
+
+#include "services/gap/ble_svc_gap.h"
+#include "services/gatt/ble_svc_gatt.h"
+#include "services/ans/ble_svc_ans.h"
+#include "services/ias/ble_svc_ias.h"
+#include "services/lls/ble_svc_lls.h"
+#include "services/tps/ble_svc_tps.h"
+#include "services/gap/ble_svc_gap.h"
+#include "services/bas/ble_svc_bas.h"
+#include "services/dis/ble_svc_dis.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Not used now */
+
+#define TASK_DEFAULT_PRIORITY       0
+#define TASK_DEFAULT_STACK          NULL
+#define TASK_DEFAULT_STACK_SIZE     0
+
+/****************************************************************************
+ * External Functions Prototypes
+ ****************************************************************************/
+
+void ble_hci_sock_ack_handler(void *param);
+void ble_hci_sock_init(void);
+void ble_hci_sock_set_device(int dev);
+
+/****************************************************************************
+ * Private Functions Prototypes
+ ****************************************************************************/
+
+static void put_ad(uint8_t ad_type, uint8_t ad_len, FAR const void *ad,
+                   FAR uint8_t *buf, FAR uint8_t *len);
+static void update_ad(void);
+static void start_advertise(void);
+static int gap_event_cb(FAR struct ble_gap_event *event, void *arg);

Review Comment:
   ```suggestion
   static int gap_event_cb(FAR struct ble_gap_event *event, FAR void *arg);
   ```



##########
examples/nimble/nimble_main.c:
##########
@@ -0,0 +1,322 @@
+/****************************************************************************
+ * apps/examples/nimble/nimble_main.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <sys/boardctl.h>
+#include <assert.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "netutils/netinit.h"
+
+#include "nimble/nimble_npl.h"
+#include "nimble/nimble_port.h"
+
+#include "host/ble_hs.h"
+#include "host/util/util.h"
+
+#include "services/gap/ble_svc_gap.h"
+#include "services/gatt/ble_svc_gatt.h"
+#include "services/ans/ble_svc_ans.h"
+#include "services/ias/ble_svc_ias.h"
+#include "services/lls/ble_svc_lls.h"
+#include "services/tps/ble_svc_tps.h"
+#include "services/gap/ble_svc_gap.h"
+#include "services/bas/ble_svc_bas.h"
+#include "services/dis/ble_svc_dis.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Not used now */
+
+#define TASK_DEFAULT_PRIORITY       0
+#define TASK_DEFAULT_STACK          NULL
+#define TASK_DEFAULT_STACK_SIZE     0
+
+/****************************************************************************
+ * External Functions Prototypes
+ ****************************************************************************/
+
+void ble_hci_sock_ack_handler(void *param);
+void ble_hci_sock_init(void);
+void ble_hci_sock_set_device(int dev);
+
+/****************************************************************************
+ * Private Functions Prototypes
+ ****************************************************************************/
+
+static void put_ad(uint8_t ad_type, uint8_t ad_len, FAR const void *ad,
+                   FAR uint8_t *buf, FAR uint8_t *len);
+static void update_ad(void);
+static void start_advertise(void);
+static int gap_event_cb(FAR struct ble_gap_event *event, void *arg);
+static void app_ble_sync_cb(void);
+static void nimble_host_task(FAR void *param);
+static FAR void *ble_hci_sock_task(FAR void *param);
+static FAR void *ble_host_task(FAR void *param);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const char g_gap_name[] = "NuttX NimBLE";

Review Comment:
   ```suggestion
   static const char *g_gap_name = "NuttX NimBLE";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org