feat(src): added device sort function
This commit is contained in:
parent
b2f6120fa5
commit
9716c20bca
|
@ -13,6 +13,7 @@
|
|||
// limitations under the License.
|
||||
#include "mynteye/device/utils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "mynteye/logger.h"
|
||||
|
@ -20,10 +21,14 @@
|
|||
#include "mynteye/device/context.h"
|
||||
#include "mynteye/device/device.h"
|
||||
|
||||
#include "mynteye/logger.h"
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
bool sort_sn(std::shared_ptr<Device> device1,
|
||||
std::shared_ptr<Device> device2) {
|
||||
return device1->GetInfo(Info::SERIAL_NUMBER) <
|
||||
device2->GetInfo(Info::SERIAL_NUMBER);
|
||||
}
|
||||
|
||||
namespace device {
|
||||
|
||||
std::shared_ptr<Device> select() {
|
||||
|
@ -37,6 +42,9 @@ std::shared_ptr<Device> select() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (n > 1)
|
||||
sort(devices.begin(), devices.end(), sort_sn);
|
||||
|
||||
LOG(INFO) << "MYNT EYE devices:";
|
||||
for (std::size_t i = 0; i < n; i++) {
|
||||
auto &&device = devices[i];
|
||||
|
|
Loading…
Reference in New Issue
Block a user