Adapted Paintpack to HIDDevice API

Former-commit-id: 06101f0e99fbe99f8994193cea337b400acbafe3
This commit is contained in:
NicoHood
2015-11-08 16:32:53 +01:00
parent a7d9a44dcc
commit 3595709099
3 changed files with 27 additions and 74 deletions

View File

@@ -181,7 +181,15 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
}
else if (type == "paintpack")
{
LedDevicePaintpack * devicePainLightpack = new LedDevicePaintpack();
const int delay_ms = deviceConfig["delayAfterConnect"].asInt();
auto VendorIdString = deviceConfig.get("VID", "0x0EBF").asString();
auto ProductIdString = deviceConfig.get("PID", "0x0025").asString();
// Convert HEX values to integer
auto VendorId = std::stoul(VendorIdString, nullptr, 16);
auto ProductId = std::stoul(ProductIdString, nullptr, 16);
LedDevicePaintpack * devicePainLightpack = new LedDevicePaintpack(VendorId, ProductId, delay_ms);
devicePainLightpack->open();
device = devicePainLightpack;