| 145 | DBus::Proxy::TargetPreset::Ptr target; |
| 146 | |
| 147 | Handler(DBus::Connection::Ptr conn) |
| 148 | { |
| 149 | try |
| 150 | { |
| 151 | proxy = DBus::Proxy::Client::Create(conn, Constants::GenServiceName("devposture")); |
| 152 | target = DBus::Proxy::TargetPreset::Create(Constants::GenPath("devposture"), |
| 153 | Constants::GenInterface("devposture")); |
| 154 | |
| 155 | auto prxqry = DBus::Proxy::Utils::DBusServiceQuery::Create(conn); |
| 156 | prxqry->CheckServiceAvail(Constants::GenServiceName("devposture")); |
| 157 | |
| 158 | // Delay the return up to 750ms, to ensure we have a valid |
| 159 | // Device Posture service object available |
| 160 | auto prxchk = DBus::Proxy::Utils::Query::Create(proxy); |
| 161 | |
| 162 | for (uint8_t i = 5; i > 0; i--) |
| 163 | { |
| 164 | if (prxchk->CheckObjectExists(target->object_path, |
| 165 | target->interface)) |
| 166 | { |
| 167 | break; |
| 168 | } |
| 169 | |
| 170 | usleep(150000); |
| 171 | } |
| 172 | } |
| 173 | catch (const DBus::Proxy::Exception &excp) |
| 174 | { |
| 175 | throw Exception("Device Posture service is unavailable"); |
| 176 | } |
| 177 | } |
| 178 | }; |
| 179 | |
| 180 | } // namespace DevPosture::Proxy |
nothing calls this directly
no test coverage detected