解决没有设备号的问题
This commit is contained in:
parent
6e091bd99c
commit
6c9b3f825a
@ -470,6 +470,15 @@ public class RowerHomeScript : PFUIPanel
|
|||||||
int truelyTime = 0;
|
int truelyTime = 0;
|
||||||
private void StartFunc(object sender, EventArgs e)
|
private void StartFunc(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
var bleDevice = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType.Rower) as BleDevice;
|
||||||
|
if (bleDevice != null)
|
||||||
|
{
|
||||||
|
deviceName = bleDevice.Name;
|
||||||
|
deviceNetwork = bleDevice.Network.ToString();
|
||||||
|
deviceAddress = bleDevice.Address;
|
||||||
|
deviceSensor = bleDevice.Sensor.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
var rowdata = (IRowerCommonData)sender;
|
var rowdata = (IRowerCommonData)sender;
|
||||||
if (rowdata != RowerData)
|
if (rowdata != RowerData)
|
||||||
return;
|
return;
|
||||||
@ -523,6 +532,10 @@ public class RowerHomeScript : PFUIPanel
|
|||||||
tempRecordData = new TempRecordData(model, files);
|
tempRecordData = new TempRecordData(model, files);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model.ManufacturerName = deviceName + " " + deviceNetwork + " " + deviceSensor;
|
||||||
|
model.DeviceNumber = $"{ deviceAddress },{ deviceSensor }";
|
||||||
|
|
||||||
var res = ConfigHelper.rowerApi.Add(model, files);
|
var res = ConfigHelper.rowerApi.Add(model, files);
|
||||||
if (res.result)
|
if (res.result)
|
||||||
{
|
{
|
||||||
@ -558,6 +571,11 @@ public class RowerHomeScript : PFUIPanel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
TempRecordData tempRecordData;
|
TempRecordData tempRecordData;
|
||||||
|
private string deviceName { get; set; }
|
||||||
|
private string deviceNetwork { get; set; }
|
||||||
|
private string deviceSensor { get; set; }
|
||||||
|
private string deviceAddress { get; set; }
|
||||||
|
|
||||||
private bool Save(string shadowids = null)
|
private bool Save(string shadowids = null)
|
||||||
{
|
{
|
||||||
RowerRecordModel model = new RowerRecordModel();
|
RowerRecordModel model = new RowerRecordModel();
|
||||||
@ -568,6 +586,11 @@ public class RowerHomeScript : PFUIPanel
|
|||||||
model.ManufacturerName = bleDevice.Name + " " + bleDevice.Network + " " + bleDevice.Sensor;
|
model.ManufacturerName = bleDevice.Name + " " + bleDevice.Network + " " + bleDevice.Sensor;
|
||||||
model.DeviceNumber = $"{ bleDevice.Address },{ bleDevice.Sensor }";
|
model.DeviceNumber = $"{ bleDevice.Address },{ bleDevice.Sensor }";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model.ManufacturerName = deviceName + " " + deviceNetwork + " " + deviceSensor;
|
||||||
|
model.DeviceNumber = $"{ deviceAddress },{ deviceSensor }";
|
||||||
|
}
|
||||||
model.Id = Id;//Guid.NewGuid().ToString();
|
model.Id = Id;//Guid.NewGuid().ToString();
|
||||||
model.Weight = App.CurrentUser.Weight;
|
model.Weight = App.CurrentUser.Weight;
|
||||||
if (string.IsNullOrEmpty(shadowids))
|
if (string.IsNullOrEmpty(shadowids))
|
||||||
@ -634,6 +657,10 @@ public class RowerHomeScript : PFUIPanel
|
|||||||
|
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
|
deviceName = "";
|
||||||
|
deviceNetwork = "";
|
||||||
|
deviceAddress = "";
|
||||||
|
deviceSensor = "";
|
||||||
pointCount = 0;
|
pointCount = 0;
|
||||||
print("初始化");
|
print("初始化");
|
||||||
if (Rower != null)
|
if (Rower != null)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user