| 176 | } |
| 177 | |
| 178 | bool SigSession::set_default_device() |
| 179 | { |
| 180 | assert(!_is_saving); |
| 181 | |
| 182 | if (_is_working){ |
| 183 | dsv_info("SigSession::set_default_device(),The current device is working, now to stop it."); |
| 184 | dsv_info("SigSession::set_default_device(), stop capture"); |
| 185 | stop_capture(); |
| 186 | } |
| 187 | |
| 188 | struct ds_device_base_info *array = NULL; |
| 189 | int count = 0; |
| 190 | |
| 191 | dsv_info("Set default device."); |
| 192 | |
| 193 | if (ds_get_device_list(&array, &count) != SR_OK) |
| 194 | { |
| 195 | dsv_err("Get device list error!"); |
| 196 | return false; |
| 197 | } |
| 198 | if (count < 1 || array == NULL) |
| 199 | { |
| 200 | dsv_err("Error! Device list is empty, can't set default device."); |
| 201 | return false; |
| 202 | } |
| 203 | |
| 204 | struct ds_device_base_info *dev = (array + count - 1); |
| 205 | ds_device_handle dev_handle = dev->handle; |
| 206 | |
| 207 | free(array); |
| 208 | |
| 209 | if (set_device(dev_handle)) |
| 210 | { |
| 211 | return true; |
| 212 | } |
| 213 | return false; |
| 214 | } |
| 215 | |
| 216 | bool SigSession::set_device(ds_device_handle dev_handle) |
| 217 | { |
no test coverage detected