25 lines
692 B
C#
25 lines
692 B
C#
|
|
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);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|