Files
Web_IoTBase_Sever_Prod/Common/DeviceConvert.cs

25 lines
692 B
C#
Raw Normal View History

2025-12-11 14:04:39 +08:00
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);
}
}
}
}