creat device based on custom code

This commit is contained in:
KalmanSLightech 2018-07-13 14:58:18 +08:00
parent 659f03ac18
commit 25220a27ed

View File

@ -100,13 +100,19 @@ std::shared_ptr<Device> Device::Create(
return std::make_shared<StandardDevice>(device); return std::make_shared<StandardDevice>(device);
} else if (strings::starts_with(name, "MYNT-EYE-")) { } else if (strings::starts_with(name, "MYNT-EYE-")) {
// TODO(JohnZhao): Create different device by name, such as MYNT-EYE-S1000 // 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; VLOG(2) << "MYNE EYE Model: " << model_s;
DeviceModel model(model_s); DeviceModel model(model_s);
switch (model.type) { if(model.type == 's') {
case 'S': switch (model.custom_code) {
case '0':
return std::make_shared<StandardDevice>(device);
case 'A':
return std::make_shared<StandardDevice>(device); return std::make_shared<StandardDevice>(device);
default: default:
LOG(FATAL) << "No such custom code now"
}
} else {
LOG(FATAL) << "MYNT EYE model is not supported now"; LOG(FATAL) << "MYNT EYE model is not supported now";
} }
} }