|
@@ -33,8 +33,8 @@ namespace BPASmartClient.Business |
|
|
{ |
|
|
{ |
|
|
ClientId = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ClientId"]); |
|
|
ClientId = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ClientId"]); |
|
|
apolloUri = System.Configuration.ConfigurationManager.AppSettings["ApolloUri"].ToString(); |
|
|
apolloUri = System.Configuration.ConfigurationManager.AppSettings["ApolloUri"].ToString(); |
|
|
InternetInfo.OrderServer= System.Configuration.ConfigurationManager.AppSettings["OrderServiceUri"].ToString(); |
|
|
|
|
|
InternetInfo.StockServer= System.Configuration.ConfigurationManager.AppSettings["StockServiceUri"].ToString(); |
|
|
|
|
|
|
|
|
InternetInfo.OrderServer = System.Configuration.ConfigurationManager.AppSettings["OrderServiceUri"].ToString(); |
|
|
|
|
|
InternetInfo.StockServer = System.Configuration.ConfigurationManager.AppSettings["StockServiceUri"].ToString(); |
|
|
|
|
|
|
|
|
InitDeviceModel(); |
|
|
InitDeviceModel(); |
|
|
InitMQTT(); |
|
|
InitMQTT(); |
|
@@ -61,15 +61,25 @@ namespace BPASmartClient.Business |
|
|
DeviceConfig deviceConfig = new DeviceConfig(); |
|
|
DeviceConfig deviceConfig = new DeviceConfig(); |
|
|
deviceConfig.Name = device.Attribute("Name").Value; |
|
|
deviceConfig.Name = device.Attribute("Name").Value; |
|
|
deviceConfig.Module = device.Attribute("Module").Value; |
|
|
deviceConfig.Module = device.Attribute("Module").Value; |
|
|
deviceConfig.DeviceId =int.Parse(device.Attribute("DeviceId").Value); |
|
|
|
|
|
|
|
|
deviceConfig.DeviceId = int.Parse(device.Attribute("DeviceId").Value); |
|
|
|
|
|
if (null != device.Element("Parameters")) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var deviceParameter in device.Element("Parameters").Elements()) |
|
|
|
|
|
{ |
|
|
|
|
|
deviceConfig.Parameters.Add(deviceParameter.Name.LocalName, deviceParameter.Value); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
foreach (var peripheralEl in device.XPathSelectElements("//Peripheral")) |
|
|
foreach (var peripheralEl in device.XPathSelectElements("//Peripheral")) |
|
|
{ |
|
|
{ |
|
|
BPASmartClient.Model.Peripheral peripheral = new BPASmartClient.Model.Peripheral(); |
|
|
BPASmartClient.Model.Peripheral peripheral = new BPASmartClient.Model.Peripheral(); |
|
|
peripheral.Module = peripheralEl.Attribute("Module").Value; |
|
|
peripheral.Module = peripheralEl.Attribute("Module").Value; |
|
|
foreach (XElement parameter in peripheralEl.Element("Parameters").Elements()) |
|
|
|
|
|
|
|
|
if (null != peripheralEl.Element("Parameters")) |
|
|
{ |
|
|
{ |
|
|
peripheral.Parameters.Add(parameter.Name.LocalName, parameter.Value); |
|
|
|
|
|
|
|
|
foreach (XElement parameter in peripheralEl.Element("Parameters").Elements()) |
|
|
|
|
|
{ |
|
|
|
|
|
peripheral.Parameters.Add(parameter.Name.LocalName, parameter.Value); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
deviceConfig.Peripherals.Add(peripheral); |
|
|
deviceConfig.Peripherals.Add(peripheral); |
|
|
} |
|
|
} |
|
|