初始化
This commit is contained in:
24
Common/DeviceConvert.cs
Normal file
24
Common/DeviceConvert.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
public class DeviceConvert
|
||||
{
|
||||
public static string Convert_To_Address(byte[] deviceAddress)
|
||||
{
|
||||
if (deviceAddress[0] == 0x00)//指令场景地址
|
||||
{
|
||||
return String.Format("{0}.{1}.{2}", deviceAddress[1], deviceAddress[2], deviceAddress[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ushort type = BitConverter.ToUInt16(deviceAddress, 2);
|
||||
return String.Format("{0:000}{1:000}{2:000}", deviceAddress[0], deviceAddress[1], type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user