Fix wrong cancellation callback id type and some typos 60/307160/2
authorKrzysztof Malysa <k.malysa@samsung.com>
Tue, 5 Mar 2024 11:47:39 +0000 (12:47 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 5 Mar 2024 12:18:37 +0000 (12:18 +0000)
Change-Id: Id7fa989f4d4178bd535522fbf87043b79add9a41

srcs/bluetooth_advert.cpp
srcs/bluetooth_advert.h

index 0ec9781eed0ad0e36792ff1ff2d209bb023921be..aa35db9f0bc64f898242dd4bf0e7909ed5b4efd2 100644 (file)
@@ -75,7 +75,7 @@ Bluetooth::ScanCallbackImpl(int result, bt_adapter_le_device_scan_result_info_s
     int err = bt_adapter_le_get_scan_result_service_data_list(
         info, BT_ADAPTER_LE_PACKET_ADVERTISING, &dataList, &count);
     if (err == BT_ERROR_NO_DATA)
-        return std::nullopt; // This is normal and often occuring situation
+        return std::nullopt; // This is normal and often occurring situation
     if (err != BT_ERROR_NONE) {
         TRY_LOG_ERROR("bt_adapter_le_get_scan_result_service_data_list() returned " << err);
         return err;
@@ -173,7 +173,7 @@ int Bluetooth::StartLEAdvertScanAndAwaitStop(CallbackType callback, void *userDa
     // Allow running the callback and await the scan stop.
     // Special care needs to be taken in the StopLEScan() function not to call g_main_loop_quit()
     // before the g_main_loop_run() starts processing events. Otherwise the g_main_loop_run()
-    // will be uninterrupted, indefinetely waiting for g_main_loop_quit() that already happened.
+    // will be uninterrupted, indefinitely waiting for g_main_loop_quit() that already happened.
     g_main_loop_run(m_mainloop);
     // Stop the scan
     err = bt_adapter_le_stop_scan();
@@ -220,7 +220,7 @@ void Bluetooth::StopLEScan()
         // g_main_context_invoke_full() cannot be used here, because we need to defer the callback
         // to be run INSIDE g_main_loop_run() in StartLEScanAndAwaitStop(), otherwise
         // g_main_loop_quit() will succeed, but the yet unstarted g_main_loop_run() will be left
-        // uninterrupted indefinetely waiting for g_main_loop_quit() that already happened.
+        // uninterrupted indefinitely waiting for g_main_loop_quit() that already happened.
         m_scanCancellationCallbackId = g_timeout_add_full(
             G_PRIORITY_HIGH,
             0,
@@ -235,7 +235,7 @@ void Bluetooth::StopLEScan()
             nullptr);
         // Allow the main thread to continue. This could cause a deadlock if some handler
         // would wait for the mutex, blocking the main loop. The main loop does internal locking and
-        // may not release the interal lock until the handler exits. This would make the above
+        // may not release the internal lock until the handler exits. This would make the above
         // g_timeout_add_full() wait indefinitely creating a deadlock.
         guard.unlock(); // may throw
         return;
@@ -339,7 +339,7 @@ int BtAdvertScanner::AwaitAdvert(const CryptoBuffer &eidKey, CryptoBuffer &decry
     };
     try {
         err = m_bluetooth->StartLEAdvertScanAndAwaitStop(callback, &cryptoData); // may throw
-        // If Cancel() occurrs here i.e. after the scan completes, it will be ignored.
+        // If Cancel() occurs here i.e. after the scan completes, it will be ignored.
         // That is because we reinitialize bluetooth before starting the new scan.
         guard.lock();
     } catch (...) {
index 2f352596c4b12a74597b2a0a3021fa503f44d211..e7c3c766ac9ee65859b8303e1cbaa6d0a887368d 100644 (file)
@@ -110,7 +110,7 @@ private:
         Starting,
         Awaiting,
     } m_scanState = ScanState::NotInProgress;
-    bool m_scanCancellationCallbackId;
+    guint m_scanCancellationCallbackId;
     std::mutex m_scanMutex;
 
     CallbackType m_scanCallback = nullptr;         // used only in the main thread