MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / set_default_device

Method set_default_device

DSView/pv/sigsession.cpp:178–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 4

on_load_device_firstMethod · 0.80
on_load_fileMethod · 0.80
confirm_to_store_dataMethod · 0.80
OnMessageMethod · 0.80

Calls 1

ds_get_device_listFunction · 0.85

Tested by

no test coverage detected