KKopyscinski commented on code in PR #1619:
URL: https://github.com/apache/mynewt-nimble/pull/1619#discussion_r1395604096


##########
nimble/host/services/auracast/src/ble_svc_auracast.c:
##########
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+#include "syscfg/syscfg.h"
+
+#include "host/ble_gap.h"
+#include "host/ble_hs.h"
+#include "host/ble_audio_broadcast.h"
+#include "services/auracast/ble_svc_auracast.h"
+
+#define AURACAST_ADV_INSTANCE \
+      MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE) < 0 ?                        \
+      (MYNEWT_VAL(BLE_MESH) ? MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES) - 1 :       \
+      MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES)) :                                 \
+      MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE)
+
+int
+ble_svc_auracast_create(const struct ble_svc_auracast_create_params *params,
+                        ble_audio_broadcast_destroy_fn *destroy_cb,
+                        void *args, ble_gap_event_fn *gap_cb)
+{
+    struct ble_broadcast_create_params create_params;
+    struct ble_gap_periodic_adv_params periodic_params = { 0 };
+    struct ble_gap_ext_adv_params extended_params = {
+        .scannable = 0,
+        .connectable = 0,
+        .primary_phy = BLE_HCI_LE_PHY_1M,
+    };
+    uint8_t own_addr_type;
+    int rc;
+
+    rc = ble_hs_id_infer_auto(0, &own_addr_type);
+    if (rc != 0) {
+        return rc;
+    }
+
+    extended_params.own_addr_type = own_addr_type;
+    extended_params.sid = AURACAST_ADV_INSTANCE;
+    extended_params.secondary_phy = MYNEWT_VAL(BLE_PHY_2M) ?
+                                    BLE_HCI_LE_PHY_2M : BLE_HCI_LE_PHY_1M;

Review Comment:
   done, added check if requested PHY is supported



##########
nimble/host/services/auracast/src/ble_svc_auracast.c:
##########
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+#include "syscfg/syscfg.h"
+
+#include "host/ble_gap.h"
+#include "host/ble_hs.h"
+#include "host/ble_audio_broadcast.h"
+#include "services/auracast/ble_svc_auracast.h"
+
+#define AURACAST_ADV_INSTANCE \
+      MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE) < 0 ?                        \
+      (MYNEWT_VAL(BLE_MESH) ? MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES) - 1 :       \
+      MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES)) :                                 \
+      MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE)
+
+int
+ble_svc_auracast_create(const struct ble_svc_auracast_create_params *params,
+                        ble_audio_broadcast_destroy_fn *destroy_cb,
+                        void *args, ble_gap_event_fn *gap_cb)
+{
+    struct ble_broadcast_create_params create_params;
+    struct ble_gap_periodic_adv_params periodic_params = { 0 };
+    struct ble_gap_ext_adv_params extended_params = {
+        .scannable = 0,
+        .connectable = 0,
+        .primary_phy = BLE_HCI_LE_PHY_1M,
+    };
+    uint8_t own_addr_type;
+    int rc;
+
+    rc = ble_hs_id_infer_auto(0, &own_addr_type);
+    if (rc != 0) {
+        return rc;
+    }
+
+    extended_params.own_addr_type = own_addr_type;
+    extended_params.sid = AURACAST_ADV_INSTANCE;

Review Comment:
   done



##########
nimble/host/services/auracast/src/ble_svc_auracast.c:
##########
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+#include "syscfg/syscfg.h"
+
+#include "host/ble_gap.h"
+#include "host/ble_hs.h"
+#include "host/ble_audio_broadcast.h"
+#include "services/auracast/ble_svc_auracast.h"
+
+#define AURACAST_ADV_INSTANCE \
+      MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE) < 0 ?                        \
+      (MYNEWT_VAL(BLE_MESH) ? MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES) - 1 :       \
+      MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES)) :                                 \
+      MYNEWT_VAL(BLE_SVC_AURACAST_ADV_INSTANCE)
+
+int
+ble_svc_auracast_create(const struct ble_svc_auracast_create_params *params,
+                        ble_audio_broadcast_destroy_fn *destroy_cb,
+                        void *args, ble_gap_event_fn *gap_cb)
+{
+    struct ble_broadcast_create_params create_params;
+    struct ble_gap_periodic_adv_params periodic_params = { 0 };
+    struct ble_gap_ext_adv_params extended_params = {
+        .scannable = 0,
+        .connectable = 0,
+        .primary_phy = BLE_HCI_LE_PHY_1M,
+    };
+    uint8_t own_addr_type;
+    int rc;
+
+    rc = ble_hs_id_infer_auto(0, &own_addr_type);

Review Comment:
   done



-- 
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-unsubscr...@mynewt.apache.org

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

Reply via email to