Former-commit-id: 9e6ccdcee38c3059765b2b80c2e3e19df11c42f9
TangShanKaiPing
wanggang 6 years ago
parent 63a0f4e093
commit f861b38146

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
namespace Infrastructure.Extensions
{
@ -56,7 +57,7 @@ namespace Infrastructure.Extensions
var buffer = new byte[length];
bytes.Read(buffer);
return new string(buffer.Select(o => (char)o).ToArray());
return Encoding.ASCII.GetString(buffer).Trim('\0');
}
public static string ReadHexString(this Stream bytes, int length)
@ -68,7 +69,7 @@ namespace Infrastructure.Extensions
var buffer = new byte[length];
bytes.Read(buffer);
return BitConverter.ToString(buffer).Replace("-", "", StringComparison.CurrentCulture).ToLower(CultureInfo.CurrentCulture);
return BitConverter.ToString(buffer.Reverse().ToArray()).Replace("-", "");
}
public static string ReadHexStringDesc(this Stream bytes, int length)

@ -207,7 +207,6 @@
<input type="hidden" name="Number" :value="model.Number" />
<input type="hidden" name="Method" :value="api.Method" />
<div class="form-group" v-for="parameter in api.Parameters" v-if="parameter.Name!=='number'">
<div>{{model.Name}}{{api.Name}}{{parameter.Name}}</div>
<label :for="parameter.Name">{{parameter.Description}}:</label>
<template v-if="model.Name==='网关'&&api.Name==='删掉制定设备'&&parameter.Name==='设备编号'">
</template>

@ -910,7 +910,7 @@ namespace IoTNode.DeviceServices.FBee
var responseType = ms.ReadByte();
var dataLength = ms.ReadByte();
var version = ms.ReadASIIString(5);
var snid = ms.ReadHexString(4);
var snid = ms.ReadHexString(3);
using (var scope = _applicationServices.CreateScope())
{
var deviceRepo = scope.ServiceProvider.GetService<IRepository<Device>>();
@ -925,9 +925,10 @@ namespace IoTNode.DeviceServices.FBee
{
this.UpdateData(deviceRepo, device, device.CreateData(Keys.Version, version, DeviceDataType.String, "版本", timestamp: timestamp));
this.UpdateData(deviceRepo, device, device.CreateData(Keys.DeviceCount, ms.ReadByte(), DeviceDataType.Int, "设备数量", timestamp: timestamp));
this.UpdateDevice(deviceRepo, device);
device.UserName = ms.ReadASIIString(20);
device.Password = ms.ReadASIIString(20);
var userName = ms.ReadASIIString(20);
var password = ms.ReadASIIString(20);
device.UserName = userName;
device.Password = password;
this.UpdateDevice(deviceRepo, device);
ms.ReadByte();
ms.ReadByte();

Loading…
Cancel
Save