private:
BluetoothLEServiceData(UUID&& uuid, const std::string& data_str) : uuid_{std::move(uuid)} {
- ScopeLogger("UUID: %s, data_str: %s", uuid.uuid_128_bit.c_str(), data_str.c_str());
+ ScopeLogger("UUID: %s, data_str: %s", uuid_.uuid_128_bit.c_str(), data_str.c_str());
data_.Parse(data_str);
const auto& service_data_obj = obj.get(kServiceData);
if (service_data_obj.is<picojson::null>()) {
return true;
- } else if (!service_data_obj.is<picojson::value>()) {
+ } else if (!service_data_obj.is<picojson::object>()) {
return false;
}
}
}
+void BluetoothLEAdapter::IsScanning(picojson::object& out) {
+ ScopeLogger();
+
+ bool is_scanning;
+ int ret = bt_adapter_le_is_discovering(&is_scanning);
+
+ if (BT_ERROR_NONE != ret) {
+ LogAndReportError(
+ PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to check for scanning in progress"), &out,
+ ("Failed to check for scanning in progress: %d (%s)", ret, get_error_message(ret)));
+ } else {
+ scanning_ = is_scanning;
+ ReportSuccess(picojson::value(is_scanning), out);
+ }
+}
+
void BluetoothLEAdapter::StartAdvertise(const picojson::value& data, picojson::object& out) {
ScopeLogger();
CHECK_BACKWARD_COMPABILITY_PRIVILEGE_ACCESS(Privilege::kBluetooth, Privilege::kBluetoothAdmin,