Get Channel capability supplemented with build-in capability @param channel metadata @returns Channel capability supplemented with build-in capability
| 38 | /// @param channel metadata |
| 39 | /// @returns Channel capability supplemented with build-in capability |
| 40 | auto GetChannelCapability(InterfaceFactory::InterfaceData<AbstractChannel> const& channelInfo) |
| 41 | { |
| 42 | try |
| 43 | { |
| 44 | auto ret = json::parse(channelInfo.m_Capability); |
| 45 | if(!ret.contains("create")) |
| 46 | { |
| 47 | std::cout << "[Warning] create property does not exist, generating default one." << std::endl; |
| 48 | C3::Core::Profiler::Gateway::EnsureCreateExists(ret); |
| 49 | } |
| 50 | C3::Core::Profiler::Gateway::AddBuildInCommands(ret, true); |
| 51 | return ret; |
| 52 | } |
| 53 | catch (json::parse_error& e) |
| 54 | { |
| 55 | throw std::runtime_error("Failed to parse channel's capability json. "s + e.what()); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | /// Get command id from string (allows negative inputs e.g "-2" for Close) |
| 60 | /// @param command Id string |
no test coverage detected