353 throw exc::CommunicationException(
"Bridge enumeration failed");
357 auto element = itr->GetObject();
358 auto t = std::make_shared<BridgeTransport>(boost::make_optional(json_get_string(element[
"path"])));
360 auto itr_vendor = element.FindMember(
"vendor");
361 auto itr_product = element.FindMember(
"product");
362 if (itr_vendor != element.MemberEnd() && itr_product != element.MemberEnd()
363 && itr_vendor->value.IsNumber() && itr_product->value.IsNumber()){
365 const auto id_vendor = (
uint16_t) itr_vendor->value.GetUint64();
366 const auto id_product = (
uint16_t) itr_product->value.GetUint64();
367 const auto device_idx = get_device_idx(id_vendor, id_product);
368 if (!is_device_supported(device_idx)){
369 MDEBUG(
"Device with idx " << device_idx <<
" is not supported. Vendor: " << id_vendor <<
", product: " << id_product);
372 }
catch(
const std::exception &e){
373 MERROR(
"Could not detect vendor & product: " << e.what());
377 t->m_device_info.emplace();
378 t->m_device_info->CopyFrom(*itr, t->m_device_info->GetAllocator());
Represents a JSON value. Use Value for UTF8 encoding and default allocator.
bool invoke_bridge_http(const boost::string_ref uri, const t_req &out_struct, t_res &result_struct, t_transport &transport, const boost::string_ref method="POST", std::chrono::milliseconds timeout=std::chrono::seconds(180))