From 25220a27ed09a964a3c54ddd16680cc8d45e4875 Mon Sep 17 00:00:00 2001 From: KalmanSLightech Date: Fri, 13 Jul 2018 14:58:18 +0800 Subject: [PATCH] creat device based on custom code --- src/device/device.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/device/device.cc b/src/device/device.cc index 0b08461..2c37017 100644 --- a/src/device/device.cc +++ b/src/device/device.cc @@ -100,14 +100,20 @@ std::shared_ptr Device::Create( return std::make_shared(device); } else if (strings::starts_with(name, "MYNT-EYE-")) { // TODO(JohnZhao): Create different device by name, such as MYNT-EYE-S1000 - std::string model_s = name.substr(9); + std::string model_s = name.substr(9,5); VLOG(2) << "MYNE EYE Model: " << model_s; DeviceModel model(model_s); - switch (model.type) { - case 'S': - return std::make_shared(device); - default: - LOG(FATAL) << "MYNT EYE model is not supported now"; + if(model.type == 's') { + switch (model.custom_code) { + case '0': + return std::make_shared(device); + case 'A': + return std::make_shared(device); + default: + LOG(FATAL) << "No such custom code now" + } + } else { + LOG(FATAL) << "MYNT EYE model is not supported now"; } } return nullptr;