加什么属性可以catch and shoot and wound

野球场上,大家catch and shoot(接球就投)的能力怎么样?
野球场上,大家catch and shoot(接球就投)的能力怎么样?出手的速度如何?命中率如何?
哎 & & & 和唠嗑一样
两个底脚三分线内基本上是我的甜心区,四十五度角还凑合,高位的话几乎从不接球就投
好吧,基本只会接球投的定点投手。大学系队替补后卫,场均打5分钟得3分,拖各位JRs后腿了
发自手机虎扑
就是因为和平常的小伙伴打他们都是持球型然后我就只好从持球型慢慢向接球型靠拢。刚开始很不适应吧,但是多练一下就习惯了。速度还好反而准备太久还没那么准。在45度和后面能打到板的地方都挺准,(练出一手好打板)还有就是在正对框的地方也能进。所以和小伙伴打的时候把球给他们我自己跑位拉空间。最后他们实在打不进了我才持球攻。
不吹,接球投篮,和背身单打后仰跳投,吾乃顶级水准!!
最喜欢跑空位接球跳投,所以打野球一般还是和熟悉的人耍,不然跑死老子都摸不到球。
您需要登录后才可以回复,请或者
370人参加识货团购999.00元
1097人参加识货团购1599.00元
69人参加识货团购799.00元
260人参加识货团购699.00元
522人参加识货团购299.00元
68人参加识货团购399.00元
283人参加识货团购799.00元
247人参加识货团购639.00元
720人参加识货团购1399.00元
330人参加识货团购1349.00元
768人参加识货团购399.00元
1924人参加识货团购399.00元/ ShootAndOtherApplication
项目语言:C#
权限:read-only(如需更高权限请先加入项目)
ShootAndOtherApplication/
Index: OPMUtils.cs
===================================================================
--- OPMUtils.cs (revision 0)
+++ OPMUtils.cs (revision 2)
@@ -0,0 +1,22 @@
+using System.Collections.G
+using System.L
+using System.T
+using System.N
+using System.Net.S
+using System.R
+namespace OmeshNetwork.Tool
public static class OPMUtils
//log出力实体
private static log4net.ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//获取当天的日期(yyyyMMdd)
public static string getTodayYMD()
return DateTime.Now.ToString(&yyyyMMdd&); ;
Index: ClassExtend.cs
===================================================================
--- ClassExtend.cs (revision 0)
+++ ClassExtend.cs (revision 2)
@@ -0,0 +1,789 @@
+using System.Collections.G
+using System.L
+using System.T
+using System.T
+using System.R
+using System.N
+using System.Net.S
+namespace OmeshNetwork.Tool
public static class ByteArray
//log出力实体
private static log4net.ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
* 从start位置开始,获取长度为length的子串;
* 若长度start + length超出数组长度,则获取从start开始到数组最后一个元素。
public static byte[] GetSub(this byte[] byteData, int start, int length)
byte[] result = new byte[length];
for (int i = 0; i & length && i & byteData.L i++)
result[i] = byteData[start + i];
* 从start位置开始,用subByteData填充byteData;
public static void MapSubByte(this byte[] byteData, byte[] subByteData, int start)
for (int i = 0; i & subByteData.Length && start + i & byteData.L i++)
byteData[start + i] = subByteData[i];
public static void ReverseMapSubByte(this byte[] byteData, byte[] subByteData, int start)
for (int i = 0; i & subByteData.Length && start + i & byteData.L i++)
byteData[start + i] = subByteData[subByteData.Length - 1 - i];
//bytes的比较
public static bool ElemEquals(this byte[] a, byte[] b)
if (a.Length != b.Length)
for (int i = 0; i & a.L i++)
if (a[i] != b[i])
// 连接两个byte数组,并返回byte数组
public static byte[] ConcatByte(this byte[] byteData0, byte[] byteData1)
return byteData0.Concat(byteData1).ToArray();
//xxx.xxx.xxx.xxx:nnnnn 对于IPPort的文字列按:进行分割
public static string[] IPPortSplit(this string targetString)
return targetString.Split(':');
//合并Byte[]变成String,并以&.&为间隔
public static string BindToString(this byte[] inData)
return inData.ToSplitStrX(10, '.');
#region 按照进制来转换byte[]或byte,并以分隔符分隔,串联成String.字节转换后不满2位的左方加填充值
//按照16进制来转换byte[],并以分隔符分隔,串联成String。字节转换后不满2位的左方加填充值
public static string ToFillingStr16(this byte[] byteData)
return byteData.ToFillingStringX(16, '.', '0');
//按照16进制来转换byte,并以分隔符分隔,串联成String。字节转换后不满2位的左方加填充值
public static string ToFillingStr16(this byte byteData)
byte[] tempBytes = new byte[1];
tempBytes[0] = byteD
return tempBytes.ToFillingStringX(16, '.', '0');
//按照进制来转换byte[],并以分隔符分隔,串联成String.字节转换后不满2位的左方加填充值
private static string ToFillingStringX(this byte[] byteData, int toBase, char spliter, char filler)
if (byteData == null)
return &&;
string resultStr = &&;
string tempStr = &&;
for (int i = 0; i & byteData.L i++)
tempStr = Convert.ToString(byteData[i], toBase).PadLeft(2, filler);
resultStr = resultStr + tempS
if (i != byteData.Length - 1)
resultStr +=
tempStr = &&;
return resultS
#endregion
#region 按照进制来转换byte[],并以分隔符分隔,串联成String.
//按照10进制来转换byte[],并以分隔符分隔,串联成String.
public static string ToSplitStr10(this byte[] byteData)
return byteData.ToSplitStrX(10, '.');
//按照16进制来转换byte[],并以分隔符分隔,串联成String.
public static string ToSplitStr16(this byte[] byteData)
return byteData.ToSplitStrX(16, '.');
//按照进制来转换byte[],并以分隔符分隔,串联成String.
private static string ToSplitStrX(this byte[] byteData, int toBase, char spliter)
if (byteData == null)
return &&;
string resultStr = &&;
string tempStr = &&;
for (int i = 0; i & byteData.L i++)
tempStr = Convert.ToString(byteData[i], toBase);
resultStr = resultStr + tempS
if (i != byteData.Length - 1)
resultStr +=
tempStr = &&;
return resultS
/// &summary&
/// 按照16进制来转换byte[],并以分隔符分隔,一位数在前面补零,串联成String.
/// &/summary&
/// &param name=&byteData&&字节&/param&
/// &param name=&spliter&&分隔符号&/param&
/// &returns&&/returns&
public static string ToSplitStr16WithZero(this byte[] byteData, char spliter)
if (byteData == null)
return &&;
string resultStr = &&;
string tempStr = &&;
for (int i = 0; i & byteData.L i++)
tempStr = Convert.ToString(byteData[i], 16);
if (tempStr.Length==1)
tempStr = &0& + tempS
resultStr = resultStr + tempS
if (i != byteData.Length - 1)
resultStr +=
tempStr = &&;
return resultS
#endregion
#region String按进制转换成byte
//按照10进制来把string转换成byte
public static byte ToByte10(this string strData)
byte result = Convert.ToByte(strData, 10);
//按照16进制来把string转换成byte
public static byte ToByte16(this string strData)
byte result = Convert.ToByte(strData, 16);
//按照进制来把string转换成byte
private static byte ToByteX(this string strData, int toBase)
if (strData == null)
throw new BLException(&BL1000001E&);
byte result = Convert.ToByte(strData, toBase);
#endregion
#region byte按进制转换成String
//按照10进制来转换byte到String
public static string ToString10(this byte byteData)
return byteData.ToStringX(10);
//按照16进制来转换byte到String
public static string ToString16(this byte byteData)
return byteData.ToStringX(16);
//按照16进制来转换byte到String
private static string ToStringX(this byte byteData, int toBase)
string resultStr = &&;
resultStr = Convert.ToString(byteData, toBase);
return resultS
#endregion
#region byte[]按进制转换成String
//按照10进制来转换byte[],串联成String.
public static string ToString10(this byte[] byteData)
return byteData.ToStringX(10);
//按照16进制来转换byte[],串联成String.
public static string ToString16(this byte[] byteData)
return byteData.ToStringX(16);
//按照进制来转换byte[],串联成String.
private static string ToStringX(this byte[] byteData, int toBase)
if (byteData == null)
return &&;
string resultStr = &&;
string tempStr = &&;
for (int i = 0; i & byteData.L i++)
tempStr = Convert.ToString(byteData[i], toBase);
resultStr = resultStr + tempStr + '.';
return resultS
#endregion
#region String按分割符进行分割,并按进制转换成byte[]
//xxx.xxx.xxx.xxx将字符串按'.'分割成10进制的Byte[]
public static byte[] StrSplitToBytes10(this string targetString)
char spliter = '.';
return targetString.StrXSplitToBytes(spliter, 10);
//xxx.xxx.xxx.xxx将字符串按'.'分割成16进制的Byte[]
public static byte[] StrSplitToBytes16(this string targetString)
char spliter = '.';
return targetString.StrXSplitToBytes(spliter, 16);
//xxx.xxx.xxx.xxx 将字符串分割成Byte[]
private static byte[] StrXSplitToBytes(this string targetString, char spliter, int toBase)
if (targetString == null)
throw new BLException(&BL1000001E&);
string[] strArray = targetString.Split(spliter);
byte[] resultData = new byte[strArray.Length];
for (int i = 0; i & strArray.L i++)
resultData[i] = strArray[i].ToByteX(toBase);
return resultD
#endregion
#region byte[],byte同ASCII码string之间的互换
//把byte[]转化为ASCII码模式的string
public static string BytesToASCII(this byte[] inData)
if (inData == null)
throw new BLException(&BL1000001E&);
string resultData = Encoding.ASCII.GetString(inData);
return resultD
//把byte[]转化为ASCII码模式的string
public static string ByteToASCII(this byte inData)
byte[] temp = new byte[1];
temp[0] = inD
string resultData = Encoding.ASCII.GetString(temp);
return resultD
//把string按ASCII模式转化为byte[]
public static byte[] ToASCIIBytes(this string inData)
if (inData != null && inData != &&)
byte[] resultData = Encoding.ASCII.GetBytes(inData);
return resultD
throw new BLException(&BL1000001E&);
//把string按ASCII模式转化为byte
public static byte ToASCIIByte(this string inData)
if (inData != null && inData != &&)
byte[] resultData = Encoding.ASCII.GetBytes(inData);
return resultData[0];
#endregion
#region byte[]的log出力
//byte[]数据的Debug出力
public static void BytesDebug(this byte[] inData)
if (inData == null)
log.Debug(&出力数据为空!&);
Global.SendMessage(&出力数据为空!&);
log.Debug(&@@@@@@@@byte[]数据的Debug开始@@@@@@@@&);
Global.SendMessage(&@@@@@@@@byte[]数据的Debug开始@@@@@@@@&);
string s = &&;
for (int i = 0; i & inData.Count(); i++)
//log.Debug(&Byte[& + i + &] = [& + inData[i].ToString() + &]&);
s += inData[i].ToString16() + & &;
log.Debug(&[& + s + &],Length=[& + inData.Count() + &]&);
Global.SendMessage(&[& + s + &],Length=[& + inData.Count() + &]&);
log.Debug(&@@@@@@@@byte[]数据的Debug终了@@@@@@@@&);
Global.SendMessage(&@@@@@@@@byte[]数据的Debug终了@@@@@@@@&);
//byte[]数据的Debug出力
public static void BytesDebug16(this byte[] inData)
if (inData == null)
log.Debug(&出力数据为空!&);
Global.SendMessage(&出力数据为空!&);
string s = string.E
for (int i = 0; i & inData.Count(); i++)
s += Convert.ToString(inData[i], 16) + & &;
log.Debug(&[& + s + &]&);
Global.SendMessage(&[& + s + &]&);
//byte[]数据的Info出力
public static void BytesInfo(this byte[] inData)
if (inData == null)
(&出力数据为空!&);
Global.SendMessage(&出力数据为空!&);
(&********byte[]数据的Debug开始********&);
Global.SendMessage(&********byte[]数据的Debug开始********&);
string s = string.E
for (int i = 0; i & inData.Count(); i++)
s += &Byte[& + i + &] = [& + inData[i].ToString16() + &]
Global.SendMessage(s);
(&********byte[]数据的Debug终了********&);
Global.SendMessage(&********byte[]数据的Debug终了********&);
//byte[]数据的Error出力
public static void BytesError(this byte[] inData)
if (inData == null)
log.Error(&出力数据为空!&);
Global.SendMessage(&出力数据为空!&);
log.Error(&********byte[]数据的Debug开始********&);
Global.SendMessage(&********byte[]数据的Debug开始********&);
string s = string.E
for (int i = 0; i & inData.Count(); i++)
s += &Byte[& + i + &] = [& + inData[i].ToString16() + &]&;
log.Error(s);
Global.SendMessage(s);
log.Error(&********byte[]数据的Debug终了********&);
Global.SendMessage(&********byte[]数据的Debug终了********&);
#endregion
//把byte[]数据转化为16进制显示的string
public static string BytestoString16(this byte[] inData)
if (inData == null)
return &&;
string resultData = &&;
for (int i = 0; i & inData.Count(); i++)
resultData += Convert.ToString(inData[i], 16);
if (i != inData.Count() - 1)
resultData += & &;
return resultD
public static string String10toString16(this string inData)
string resultD
resultData = Convert.ToString(int.Parse(inData), 16);
return resultD
//把string按ASCII模式转化为16进制显示的string,中间用空格隔开
public static string StringtoString16(this string inData)
string resultD
resultData = inData.ToASCIIBytes().BytestoString16();
return resultD
//把port转换成byte[]
public static byte[] PortToBytes(this string inData)
int port = int.Parse(inData);
byte[] data = new byte[2];
data[0] = (byte)(port / 256);
data[1] = (byte)(port % 256);
//把IP转换成byte[](IP6格式)
public static byte[] IPAddressToBytes(this string inData)
IPAddress ipAddress = IPAddress.Parse(inData);
byte[] data = new byte[17];
if (ipAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
data[0] = 0;
data[0] = 1;
data.MapSubByte(ipAddress.GetAddressBytes(), 1);
//按照进制来转换byte[],并以分隔符分隔,串联成String.
public static string ToSplitStr16With0(this byte[] byteData)
if (byteData == null)
return &&;
string spliter = &.&;
string resultStr = &&;
string tempStr = &&;
for (int i = 0; i & byteData.L i++)
tempStr = Convert.ToString(byteData[i], 16);
if (tempStr.Length == 1)
tempStr = &0& + tempS
resultStr = resultStr + tempS
if (i != byteData.Length - 1)
resultStr +=
tempStr = &&;
return resultS
//把string转化为byte, 数据为空时,设0
public static byte StringToByte(this string inData)
if (inData != null && inData != &&)
byte[] resultData = Encoding.Default.GetBytes(inData);
return resultData[0];
//把string转化为byte[]
public static byte[] StringToBytes(this string inData)
if (inData != null && inData != &&)
byte[] resultData = Encoding.Default.GetBytes(inData);
return resultD
//把byte[]转化为string
public static string BytesToString(this byte[] inData)
string resultData = Encoding.Default.GetString(inData);
return resultD
//把byte转化为string
public static string ByteToString(this byte inData)
byte[] tempBytes = new byte[1];
tempBytes[0] = inD
string resultData = Encoding.Default.GetString(tempBytes);
return resultD
#region 根据字节数对字符串进行截取
//根据字节数对字符串进行截取
public static String bSubstring(this string s, int length)
byte[] bytes = System.Text.Encoding.Unicode.GetBytes(s);
int n = 0;
表示当前的字节数
int i = 0;
要截取的字节数
for (; i & bytes.GetLength(0) && n & i++)
偶数位置,如0、2、4等,为UCS2编码中两个字节的第一个字节
if (i % 2 == 0)
在UCS2第一个字节时n加1
当UCS2编码的第二个字节大于0时,该UCS2字符为汉字,一个汉字算两个字节
if (bytes[i] & 0)
如果i为奇数时,处理成偶数
if (i % 2 == 1)
该UCS2字符是汉字时,去掉这个截一半的汉字
if (bytes[i] & 0)
i = i - 1;
该UCS2字符是字母或数字,则保留该字符
i = i + 1;
return System.Text.Encoding.Unicode.GetString(bytes, 0, i);
#endregion
public enum MessageEnum
public static class CommonMethods
public static string MessageBox(string TxtMessage)
str = &&script type='text/javascript'&alert('& + TxtMessage + &');&/script&&;
public static string MessageBox(string TxtMessage, string Url)
str = &&script type='text/javascript'&alert('& + TxtMessage + &');location='& + Url + &'&/script&&;
public static string ConfirmBox(string TxtMessage)
str = &&script type='text/javascript'&confirm('& + TxtMessage + &');&/script&&;
public static string CustomerMessageBox(string TxtMessage, MessageEnum msgEnum)
string type = &1&;
switch (msgEnum)
case MessageEnum.Alarm:
type = &0&;
case MessageEnum.Error:
type = &5&;
case MessageEnum.OK:
type = &1&;
StringBuilder str = new StringBuilder();
str.AppendLine(&&script type='text/javascript'&&);
str.AppendLine(&
$(function(){&);
str.AppendLine(&
if(parent&&parent.$.layer)&);
str.AppendLine(&
str.AppendLine(&
parent.$.layer({&);
str.AppendLine(&
dialog: { type:& + type + & , msg: \&& + TxtMessage + &\& }&);
str.AppendLine(&
str.AppendLine(&
str.AppendLine(&
if($.layer){&);
str.AppendLine(&
$.layer({&);
str.AppendLine(&
dialog: { type:& + type + & , msg: \&& + TxtMessage + &\& }&);
str.AppendLine(&
str.AppendLine(&
}else{alert(\&& + TxtMessage + &\&)} &);
str.AppendLine(&
if (msgEnum == MessageEnum.OK)
str.AppendLine(& if (parent && typeof (parent.load) == \&function\&)&);
str.AppendLine(&
parent.load();&);
str.AppendLine(&
str.AppendLine(&
&/script&&);
return str.ToString();
Index: VerifyData.cs
===================================================================
--- VerifyData.cs (revision 0)
+++ VerifyData.cs (revision 2)
@@ -0,0 +1,36 @@
+using System.Collections.G
+using System.L
+using System.T
+namespace OmeshNetwork.Tool
public static class VerifyData
public static bool crcVerification(byte[] data)
if (data == null || data.Length & 3)
//if (data[2] != (byte)NetworkMngtMessageType.UpgradeCmdResult)
byte[] msgData = data.GetSub(0, data.Length - 2);
byte[] crcData = data.GetSub(data.Length - 2, 2);
return CRC.Crc16Check(msgData, crcData);
catch (Exception)
Index: MathClass.cs
===================================================================
--- MathClass.cs (revision 0)
+++ MathClass.cs (revision 2)
@@ -0,0 +1,59 @@
+using System.Collections.G
+using System.L
+using System.T
+using System.T
+//数学计算类
+namespace OmeshNetwork.Tool
public class MathClass
public static LockMaxSeq _MAXSEQ = new LockMaxSeq();
//获取唯一主键字符串(40位)
public string getUniqueKeyString()
string dateTimeStr = DateTime.Now.ToString(&yyyyMMddHHmmfffffff&);
for (int i = 1; i &= 3; i++)
//string tempStr = getRandomString();
dateTimeStr = dateTimeStr + getRandomString();
Thread.Sleep(5);
return dateTimeS
//获取随机值(string)
public string getRandomString(int maxValue, int length)
int randaomValue = new System.Random().Next(maxValue);
string result = randaomValue.ToString().PadLeft(length, '0');
public class LockMaxSeq
private Int64 maxS
public LockMaxSeq()
this.maxSeq = 1000;
public Int64 MaxSeq
return this.maxSeq++;
Index: ConvertHelper.cs
===================================================================
--- ConvertHelper.cs (revision 0)
+++ ConvertHelper.cs (revision 2)
@@ -0,0 +1,762 @@
+/// &summary&
+/// 类说明:Assistant
+/// 编 码 人:苏飞
+/// 联系方式:
+/// 更新网站:/thread-655-1-1.html
+/// &/summary&
+/** 1. 功能:处理数据类型转换,数制转换、编码转换相关的类
2. 作者:周兆坤
3. 创建日期:
4. 最后修改日期:
+using System.T
+using System.Text.RegularE
+namespace OmeshNetwork.Tool
/// &summary&
/// 处理数据类型转换,数制转换、编码转换相关的类
/// &/summary&
public sealed class ConvertHelper
#region 补足位数
/// &summary&
/// 指定字符串的固定长度,如果字符串小于固定长度,
/// 则在字符串的前面补足零,可设置的固定长度最大为9位
/// &/summary&
/// &param name=&text&&原始字符串&/param&
/// &param name=&limitedLength&&字符串的固定长度&/param&
public static string RepairZero(string text, int limitedLength)
//补足0的字符串
string temp = &&;
for (int i = 0; i & limitedLength - text.L i++)
temp += &0&;
//连接text
//返回补足0的字符串
#endregion
#region 各进制数间转换
/// &summary&
/// 实现各进制数间的转换。ConvertBase(&15&,10,16)表示将十进制数15转换为16进制的数。
/// &/summary&
/// &param name=&value&&要转换的值,即原值&/param&
/// &param name=&from&&原值的进制,只能是2,8,10,16四个值。&/param&
/// &param name=&to&&要转换到的目标进制,只能是2,8,10,16四个值。&/param&
public static string ConvertBase(string value, int from, int to)
int intValue = Convert.ToInt32(value, from);
//先转成10进制
string result = Convert.ToString(intValue, to);
//再转成目标进制
if (to == 2)
int resultLength = result.L
//获取二进制的长度
switch (resultLength)
result = &0& +
result = &00& +
result = &000& +
result = &0000& +
result = &00000& +
//LogHelper.WriteTraceLog(TraceLogLevel.Error, ex.Message);
return &0&;
#endregion
#region 使用指定字符集将string转换成byte[]
/// &summary&
/// 使用指定字符集将string转换成byte[]
/// &/summary&
/// &param name=&text&&要转换的字符串&/param&
/// &param name=&encoding&&字符编码&/param&
public static byte[] StringToBytes(string text, Encoding encoding)
return encoding.GetBytes(text);
#endregion
#region 使用指定字符集将byte[]转换成string
/// &summary&
/// 使用指定字符集将byte[]转换成string
/// &/summary&
/// &param name=&bytes&&要转换的字节数组&/param&
/// &param name=&encoding&&字符编码&/param&
public static string BytesToString(byte[] bytes, Encoding encoding)
return encoding.GetString(bytes);
#endregion
#region 将byte[]转换成int
/// &summary&
/// 将byte[]转换成int
/// &/summary&
/// &param name=&data&&需要转换成整数的byte数组&/param&
public static int BytesToInt32(byte[] data)
//如果传入的字节数组长度小于4,则返回0
if (data.Length & 4)
//定义要返回的整数
int num = 0;
//如果传入的字节数组长度大于4,需要进行处理
if (data.Length &= 4)
//创建一个临时缓冲区
byte[] tempBuffer = new byte[4];
//将传入的字节数组的前4个字节复制到临时缓冲区
Buffer.BlockCopy(data, 0, tempBuffer, 0, 4);
//将临时缓冲区的值转换成整数,并赋给num
num = BitConverter.ToInt32(tempBuffer, 0);
//返回整数
#endregion
#region 数字转换
/// &summary&判断是否为数字类型,包括[+-]号,小数字
/// 包括(boolean/byte/int16/int32/int64/single/double/decimal)
/// &/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static bool IsNumeric(string str)
if (string.IsNullOrEmpty(str))
if (str.Length & 18)
return (new Regex(&^[\\+\\-]?[0-9]*\\.?[0-9]+$&)).IsMatch(str);
/// &summary&判断是否为数字类型,包括[+-]号,小数字
/// 包括(boolean/byte/int16/int32/int64/single/double/decimal)
/// &/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static bool IsNumeric(object str)
if (str != null)
return IsNumeric(str.ToString());
/// &summary&判断是否为整型数字(int32),不包括-&/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static bool IsInt(string str)
if (string.IsNullOrEmpty(str))
if ((str.Length & 10) || (str.Length == 10 && str[0] != '1'))
for (int i = 0; i & str.L i++)
if ((str[i] & '0') || (str[i] & '9'))
/// &summary&判断是否为整型数字,包括(int32)&/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static bool IsInt(object str)
if (str != null)
return IsInt(str.ToString());
/// &summary&判断是否为整型数字,包括(int64)&/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static bool IsLong(string str)
if (string.IsNullOrEmpty(str))
if (str.Length & 18)
for (int i = 0; i & str.L i++)
if ((str[i] & '0') || (str[i] & '9'))
/// &summary&判断是否为整型数字,包括(int64)&/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static bool IsLong(object str)
if (str != null)
return IsInt(str.ToString());
/// &summary&判断是否为浮点数字,用于货币,数量,包括小数字,但不包[+-]号,最多18位
/// 包括(single/double/decimal)
/// &/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static bool IsFloat(string str)
if (string.IsNullOrEmpty(str))
if (str.Length & 18)
return (new Regex(&^[0-9]*\\.?[0-9]+$&)).IsMatch(str);
/// &summary&判断是否为浮点数字,用于货币,数量,包括小数字,但不包[+-]号
/// 包括(single/double/decimal)
/// &/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static bool IsFloat(object str)
if (str != null)
return IsFloat(str.ToString());
/// &summary&把string 转 int32 ,从左边继位检查转换(不管输入的是小数,还是字母)&/summary&
/// &param name=&str&&&/param&
/// &param name=&defValue&&&/param&
/// &returns&&/returns&
public static int Cint(string str, int defValue = 0)
if (string.IsNullOrEmpty(str))
return defV
int iLen = str.L
if (iLen & 10)
return defV
string ss = &&;
bool isFlag = (str[0] == '-');
int iStart = isFlag ? 1 : 0;
for (int i = iS i & iL i++)
if ((str[i] & '0') || (str[i] & '9'))
ss += str[i].ToString();
if (ss.Length & 9)
if (isFlag)
ss = &-& +
return ss == && ? defValue : int.Parse(ss);
/// &summary&把string 转 int32 ,从左边继位检查转换(不管输入的是小数,还是字母)&/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static int Cint(object str)
if (str != null)
return Cint(str.ToString());
/// &summary&把string 转 int32,判断是否小于minValue,小于返回minValue&/summary&
/// &param name=&str&&&/param&
/// &param name=&minValue&&当Value少于该值时,返回该值&/param&
/// &returns&&/returns&
public static int CintMinValue(string str, int minValue)
int tmp = Cint(str);
return tmp & minValue ? minValue :
/// &summary&把string 转 int32,判断是否小于minValue,小于返回minValue&/summary&
/// &param name=&str&&&/param&
/// &param name=&minValue&&当Value少于该值时,返回该值&/param&
/// &returns&&/returns&
public static int CintMinValue(object str, int minValue)
if (str != null)
return CintMinValue(str.ToString(), minValue);
return minV
/// &summary&把string 转 int32,小于0返回0,否则返回int值&/summary&
/// &param name=&str&&&/param&
/// &returns&返回&=0的int型&/returns&
public static int Cint0(string str)
return CintMinValue(str, 0);
/// &summary&把string 转 int32,小于0返回0,否则返回int值&/summary&
/// &param name=&str&&&/param&
/// &returns&返回&=0的int型&/returns&
public static int Cint0(object str)
return CintMinValue(str, 0);
/// &summary&把string 转 int32,小于1返回1,否则返回int值&/summary&
/// &param name=&str&&&/param&
/// &returns&返回&=1的int型&/returns&
public static int Cint1(string str)
return CintMinValue(str, 1);
/// &summary&把string 转 int32,小于0返回0,否则返回int值&/summary&
/// &param name=&str&&&/param&
/// &returns&返回&=1的int型&/returns&
public static int Cint1(object str)
return CintMinValue(str, 1);
/// &summary&不等于&1&,就为&0&,用于审核之类的&/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static byte Ctinyint(string str)
return StringToByte(str, 0);
/// &summary&不等于&1&,就为&0&,用于审核之类的&/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static byte Ctinyint(object str)
if (str != null)
return Ctinyint(str.ToString());
#region Decimal 相关
/// &summary&把string 转 decimal ,从左边继位检查转换(不管输入的是小数,还是字母)&/summary&
/// &param name=&str&&&/param&
/// &param name=&defValue&&&/param&
/// &returns&&/returns&
public static decimal Cdecimal(string str, int defValue = 0)
if (string.IsNullOrEmpty(str))
return defV
if (str.Length & 18)
return defV
if (IsNumeric(str))
return decimal.Parse(str);
return defV
/// &summary&把string 转 decimal ,从左边继位检查转换(不管输入的是小数,还是字母)&/summary&
/// &param name=&str&&&/param&
/// &param name=&defValue&&&/param&
/// &returns&&/returns&
public static decimal Cdecimal(object str, int defValue = 0)
if (str != null)
return Cdecimal(str.ToString());
return defV
/// &summary&把string 转 decimal ,小于0返回0,否则返回int值&/summary&
/// &param name=&str&&&/param&
/// &returns&返回&=0的int型&/returns&
public static decimal Cdecimal0(string str)
decimal tmp = Cdecimal(str);
return tmp & 0 ? 0 :
/// &summary&把string 转 decimal ,小于0返回0,否则返回int值&/summary&
/// &param name=&str&&&/param&
/// &returns&返回&=0的int型&/returns&
public static decimal Cdecimal0(object str)
return Cdecimal0(str + &&);
#endregion
/// &summary&把string 转 long/int64 ,从左边继位检查转换(不管输入的是小数,还是字母)&/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static long Clng(string str)
if (string.IsNullOrEmpty(str))
int iLen = str.L
if (iLen & 18)
string ss = &&;
for (int i = 0; i & iL i++)
if ((str[i] & '0') || (str[i] & '9'))
ss += str[i].ToString();
if (ss == &&)
return long.Parse(ss.ToString());
/// &summary&把string 转 long/int64 ,从左边继位检查转换(不管输入的是小数,还是字母)&/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static long Clng(object str)
if (str != null)
return Clng(str.ToString());
/// &summary&把string 转 Double ,从左边继位检查转换(不管输入的是小数,还是字母)&/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static double Cdbl(string str)
if (string.IsNullOrEmpty(str))
if (str.Length & 18)
if (IsNumeric(str.ToString()))
return double.Parse(str);
/// &summary&把string 转 Double ,从左边继位检查转换(不管输入的是小数,还是字母)&/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static double Cdbl(object str)
if (str != null)
return Cdbl(str.ToString());
/// &summary&把string 转 Double ,小于0返回0,否则返回int值&/summary&
/// &param name=&str&&&/param&
/// &returns&返回&=0的int型&/returns&
public static double Cdbl0(string str)
double tmp = Cdbl(str);
if (tmp & 0)
/// &summary&把string 转 Double ,小于0返回0,否则返回int值&/summary&
/// &param name=&str&&&/param&
/// &returns&返回&=0的int型&/returns&
public static double Cdbl0(object str)
return Cdbl0(str.ToString());
/// &summary&限制数值,不得少于 iMin ,比如分页数,不能少于 1&/summary&
/// &param name=&str&&&/param&
/// &param name=&iMin&&&/param&
/// &returns&&/returns&
public static int MinInt(int str, int iMin)
if (str & iMin)
/// &summary&限制数值,不得少于 iMin ,比如分页数,不能少于 1&/summary&
/// &param name=&str&&&/param&
/// &param name=&iMin&&&/param&
/// &returns&&/returns&
public static double MinDbl(double str, double iMin)
if (str & iMin)
/// &summary&限制数值,不得少于 iMin ,比如分页数,不能少于 1&/summary&
/// &param name=&str&&&/param&
/// &param name=&iMin&&&/param&
/// &returns&&/returns&
public static double MinDbl(object str, double iMin)
if (str != null)
return MinDbl(Cdbl(str.ToString()), iMin);
#endregion
#region byts转换
/// &summary&字符串转为Btye类型
/// &/summary&
/// &param name=&str&&字符串值&/param&
/// &param name=&value&&值,请输入0或1&/param&
/// &returns&byte值&/returns&
public static byte StringToByte(String str, int value = 0)
return byte.Parse(str);
catch (Exception)
return (byte)
/// &summary&将String 转为 byte[] &/summary&
/// &param name=&str&&&/param&
/// &returns&&/returns&
public static byte[] StringToByteArray(string str)
//return Encoding.Default.GetBytes(str);
return Encoding.UTF8.GetBytes(str);
/// &summary&将byte[] 转为
String&/summary&
/// &param name=&bytes&&&/param&
/// &returns&&/returns&
public static string ByteArrayToString(byte[] bytes)
//return .Encoding.Default.GetString(bytes);
return Encoding.UTF8.GetString(bytes);
/// &summary&将Hex String 转为 byte[] &/summary&
/// &param name=&hexString&&&/param&
/// &returns&&/returns&
public static byte[] HexStringToByteArray(string hexString)
byte[] returnBytes = new byte[hexString.Length / 2];
for (int i = 0; i & returnBytes.L i++)
returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
return returnB
/// &summary&将byte[] 转为 Hex String&/summary&
/// &param name=&bytes&&&/param&
/// &returns&&/returns&
public static string ByteArrayToHexString(byte[] bytes)
char[] c = new char[bytes.Length * 2];
for (int i = 0; i & bytes.L i++)
b = bytes[i] && 4;
c[i * 2] = (char)(55 + b + (((b - 10) && 31) & -7));
b = bytes[i] & 0xF;
c[i * 2 + 1] = (char)(55 + b + (((b - 10) && 31) & -7));
return new string(c);
/// &summary&将byte[] 转为 Hex String(和上面的函数相比这个性能会慢一些,但是它是官方函数)&/summary&
/// &param name=&bytes&&&/param&
/// &returns&&/returns&
public static string ByteArrayToHexString2(byte[] bytes)
string hex = BitConverter.ToString(bytes);
return hex.Replace(&-&, &&);
#endregion
/// &summary&
/// 转换成byte[],高字节在前
/// &/summary&
/// &param name=&seqNum&&&/param&
/// &returns&&/returns&
public static byte[] ParseTwoByte(ushort num)
byte[] data = new byte[2];
data[0] = (byte)(num / 256);
data[1] = (byte)(num % 256);
public static byte[] ParseTwoByte(int num)
byte[] data = new byte[2];
data[0] = (byte)(num / 256);
data[1] = (byte)(num % 256);
/// &summary&
/// 转换成ushort,高字节在前
/// &/summary&
public static ushort ParseUInt16(byte hbyte, byte lbyte)
return (ushort)(hbyte * 256 + lbyte);
/// &summary&
/// 转换成ushort,单个字节
/// &/summary&
public static ushort ParseUInt16(byte b)
return (ushort)(b);
Index: Global.cs
===================================================================
--- Global.cs (revision 0)
+++ Global.cs (revision 2)
@@ -0,0 +1,97 @@
+using System.Collections.G
+using System.L
+using System.T
+using OmeshEnvC
+namespace OmeshNetwork.Tool
public class Global
//需要请求的webService配置
public static string webServiceIp =
public static string webServicePort =
public static string messageSet =
public static string basePath
return System.Configuration.ConfigurationManager.AppSettings[&basePath&];
LoadConfig.LoadBasePath();
//= @&D:\OPMPicture&;
//当前协议版本号
public const byte Version = 0x01;
//服务器PassCode
public static string PassCode = &11.22.33.44&;
//服务器IP
public static string ServerIP = &0.0.0.0&;
//服务器端口
public static int ServerPort = 0;
//网管服务器IP
public static string OpmMgtServerIP = &0.0.0.0&;
//网管服务器TCP Port
public static int OpmMgtTcpPort = 20068;
public static string LightNetworkId = &&;
public static string NetworkId = &&;
//是否加载了配置
public static int isLoadConfig = -1;
public static List&SetttingFactory& setting_list = new List&SetttingFactory&();
public static int HeartBeatInterval { }
/// &summary&
/// 消息发送
/// &/summary&
/// &param name=&msg&&&/param&
public static void SendMessage(string msg)
UDPClient client = new UDPClient();
client.Send(msg);
public class
SetttingFactory
public string isConfig { }
public string passcode { }
public string serverIp { }
public string serverPort { }
public string opmServerIp { }
public string opmServerPort { }
public string lighetNetworkId { }
public string networkId { }
public string basepath { }
public string webServiceIP { }
public string webServicePort { }
public string messageSet { }
Index: PlanNode.cs
===================================================================
--- PlanNode.cs (revision 0)
+++ PlanNode.cs (revision 2)
@@ -0,0 +1,107 @@
+using System.Collections.G
+using System.L
+using System.T
+namespace OmeshNetwork.Tool
class PlanNode
public string networkID
public string nodeId
public string relayId
public PlanNode()
public PlanNode(string networkId, string nodeId,string realyId)
this.networkID = networkId;
this.nodeId = nodeId;
this.relayId = realyId;
public class PlanNodeWithName
public List&PlanNode& planNodeList
public string shotTime
public string planName
public PlanNodeWithName()
planNodeList = new List&PlanNode&();
public PlanNodeWithName(string name)
planName =
planNodeList = new List&PlanNode&();
public PlanNodeWithName(String name, List&PlanNode& pnList)
this.planName =
this.planNodeList = pnL
public PlanNodeWithName(String name, List&PlanNode& pnList,string time)
this.planName =
this.planNodeList = pnL
this.shotTime =
public void AddOnePlanNode(PlanNode pn)
if (planNodeList == null)
planNodeList = new List&PlanNode&();
bool isAdd =
foreach (PlanNode tempNode in planNodeList)
if (tempNode == pn)
if (!isAdd)
planNodeList.Add(pn);
Index: ConstValue.cs
===================================================================
--- ConstValue.cs (revision 0)
+++ ConstValue.cs (revision 2)
@@ -0,0 +1,252 @@
+using System.Collections.G
+using System.L
+using System.T
+namespace OmeshNetwork.Tool
public static class ConstValue
public static string SERVER_LISTNER = &ServerListner&;
//处理程序名
public static string PROC_PROGRAM = &proc_program&;
//处理程序名
public static string PROC_PROGRAM_INIT = &proc_program_init&;
//处理程序名
public static string PROC_PROGRAM_MNG = &proc_program_mng&;
//数据被锁定
public static string DATA_LOCKED = &1&;
//正常返回值
public static string NORMAL = &0&;
//网络强制删除Flag
public static string FORCED_DELETE = &1&;
public static string Network = &Network&;
//SeqNum的起始点
public static ushort SEQNUM_STARTINDEX = 10000;
//SeqNum的最大边界
public static int SEQNUM_MAXINDEX = 65530;
//用户类型(管理员)
public static string USERTYPE_ADMIN = &00&;
//用户类型(普通用户)
public static string USERTYPE_NORMAL = &01&;
//用户类型(注册申请用户)
public static string USERTYPE_QUEUE = &02&;
//用户已存在
public static string USERREPITITION = &01&;
//删除Flag-正常数据
public static string DELETEFLAG_NORMAL = &0&;
//删除Flag-已删除数据
public static string DELETEFLAG_DELETED = &1&;
//远程操作执行状态-执行中
public static string MNG_STATUS_EXECUTING = &1&;
//远程操作执行状态-已完成
public static string MNG_STATUS_FINISHED = &0&;
//远程操作交互区分-WEB指令
public static string CONVERSATION_TYPE_WEBCMD = &01&;
//远程操作交互区分-服务器指令
public static string CONVERSATION_TYPE_SVRCMD = &02&;
//远程操作交互区分-指令执行结果
public static string CONVERSATION_TYPE_CMDRESULT = &03&;
//灯控交互区分-WEB指令
public static string LIGHT_CONV_TYPE_WEBCMD = &01&;
//灯控交互区分-服务器预留信息
public static string LIGHT_CONV_SVRINFO = &02&;
//灯控交互区分-服务器指令
public static string LIGHT_CONV_SVRCMD = &03&;
//灯控交互区分-指令响应
public static string LIGHT_CONV_RESPONSE = &04&;
//电文中每组路灯的数量限制
public static int LIGHT_LIMIT_VALUE = 30;
//电文中每组路灯的数量限制
public static int LIGHT_LIMIT_VALUE_2 = 25;
//电文中每组路灯的数量限制
public static int LIGHT_LIMIT_VALUE_ABNORMAL = 15;
//电文中每组路灯的数量限制
public static int LIGHT_LIMIT_VALUE_ABNORMAL_2 = 12;
//节点类型-网关
public static string NODETYPE_GATEWAY = &00&;
//节点类型-网点
public static string NODETYPE_NODE = &01&;
//节点类型-网关以节点身份注册
public static string NODETYPE_NODEGATEWAY = &01&;
//设备类型-网关
public static string DEVICETYPE_GATEWAY = &00&;
//设备类型-网点
public static string DEVICETYPE_NODE = &01&;
//设备类型-移动设备
public static string DEVICETYPE_MOBILE = &02&;
//设备排除区分
public static string REJECT_TYPE = &00&;
//网关的IPPORT-网点时为空值
public static string GATEWAY_IPPORT_BLANK = &&;
//工作模式-应用模式
public static string WORKMODE_APPLICATION = &0&;
//工作模式-网管模式
public static string WORKMODE_WEBMASTER = &1&;
//管理员账户
public static string USER_ADMIN = &admin&;
//指令执行结果监视间隔时间
public static int MONITORING_PERIORD = 6;
//public static int MONITORING_PERIORD = 3000;
//指令重发次数
public static int COMMAND_RESEND_TIMES = 3;
//获取硬件配置指令(WebCmd)
public static string WEBCMD_READ_HARDWARE = &01&;
//更新配置指令(WebCmd)
public static string WEBCMD_UPDATE_HARDWARE = &03&;
//获取网络监控数据指令(WebCmd)
public static string WEBCMD_READ_NETWORKDATA = &05&;
//刷机指令(WebCmd)
public static string WEBCMD_UPGRADE = &07&;
//刷机数据(WebCmd)
public static string WEBCMD_UPDATE_DATA = &09&;
//通信能力测试指令(WebCmd)
public static string WEBCMD_COMMUNICATION_TEST = &0a&;
//信号强度测试指令(WebCmd)
public static string WEBCMD_RSSI_TEST = &10&;
//测试停止指令(WebCmd)
public static string WEBCMD_STOP_TEST = &14&;
//设备重启指令(WebCmd)
public static string WEBCMD_RESET = &f1&;
//CPA指令(WebCmd)
public static string WEBCMD_CPA = &f2&;
//CS指令(WebCmd)
public static string WEBCMD_CLEAR_STASTICS = &f3&;
//Calibrate指令(WebCmd)
public static string WEBCMD_CALIBRATE = &f4&;
//获取Calibration指令(WebCmd)
public static string WEBCMD_READ_CALIBRATION = &17&;
//指令解析Header(WebCmd)
public static string WEBCMD_COMMON_WORD = &Web指令:&;
//指令解析Header(WebCmd)
public static string SVRCMD_COMMON_WORD = &服务器指令:&;
//指令解析Header(WebCmd)
public static string CMDRESULT_COMMON_WORD = &管理指令执行结果:&;
//指令执行成功
public static string CMDRESULT_SUCCESS = &网络管理指令正常执行结束!&;
//指令执行成功
public static string CMDRESULT_SUCCESS_RS = &Read stastics success!&;
//指令执行成功
public static string CMDRESULT_SUCCESS_REST = &OPM15 rest success!&;
//指令执行成功
public static string CMDRESULT_SUCCESS_CPA = &OPM15 clear previous address success!&;
//指令执行成功
public static string CMDRESULT_SUCCESS_CS = &OPM15 clear stastics success!&;
//指令执行成功
public static string CMDRESULT_SUCCESS_C = &OPM15 caliberate success!&;
//指令执行失败
public static string CMDRESULT_FALIURE = &Sorry:Command on failure!&;
//没有接受到结果
public static string CMDRESULT_NORESULT = &没有在指定时间内接收到执行结果数据!&;
//Calibrate无数据
public static string CMDRESULT_PLEASE_CALIBRATE = &Please calibrate first!&;
//附近无网点
public static string CMDRESULT_NO_NEARBY_NODE = &附近没有网点存在!&;
public static string CMDRESULT_REUPGRADEDATA = &Warning:request again!&;
//电池电量不足值
public static ushort BatteryValue = 20;
//Calibration 17个0的字节
public static byte[] CALIBRATION_ZERO_17 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
//通用配置读取数据等待时间
public static int CommonConfigurationSleepTime = 100;
//单次传输数据长度限制
public static int TRANSFER_LENGTH_LIMIT = 70;
//单次传输等待时间
public static int TRANSFER_WAIT_PERIOD = 1000;
//单次传输等待时间
public static int TRANSFER_WAIT_PERIOD_FOR_SEGMENT = 100;
public static int PM33F_ROW_SIZE = 64 * 8;
public static int EE30F_ROW_SIZE = 16;
public static byte COMMAND_NACK = 0x00;
public static byte COMMAND_ACK = 0x01;
public static byte COMMAND_READ_PM = 0x02;
public static byte COMMAND_WRITE_PM = 0x03;
public static byte COMMAND_READ_EE = 0x04;
public static byte COMMAND_WRITE_EE = 0x05;
public static byte COMMAND_READ_CM = 0x06;
public static byte COMMAND_WRITE_CM = 0x07;
public static byte COMMAND_RESET = 0x08;
public static byte COMMAND_READ_ID = 0x09;
public static int PM_SIZE = 1536; /* Max: 144KB/3/32=1536 PM rows for 30F. */
public static int EE_SIZE = 128; /* 4KB/2/16=128 EE rows */
public static int CM_SIZE = 8;
//指令执行结果额外监视间隔时间
public static int LIGHT_MONITORING_PERIORD = 35;
//灯控网络默认心跳间隔
public static string LIGHT_HEARTBEAT_INTERVAL = &90&;
//灯控默认分组
public static string LIGHT_DEFAULT_GROUP = &0000&;
//网络安全区分-normal
public static string ACCESS_TYPE_NORMAL = &00&;
//灯控网络
public static string PRO_LIGHT = &LIGHT&;
//设置类型标识
public static ushort SET_TYPE_HEARTBEAT_INTERVAL = 0x01;
//灯控网络默认心跳间隔(30秒)
public static int LIGHT_HEARTBEAT_INTERVAL_VALUE = 30;
Index: LoadConfig.cs
===================================================================
--- LoadConfig.cs (revision 0)
+++ LoadConfig.cs (revision 2)
@@ -0,0 +1,694 @@
+using System.Collections.G
+using System.Collections.S
+using System.C
+using System.L
+using System.T
+using System.X
+namespace OmeshNetwork.Tool
public static class LoadConfig
* 计划表的配置包含了4个方法
* 添加一个计划
* 删除一个计划(连同下面的所有节点全部删除掉)
* 返回计划,及计划中所有的节点
* 返回一个计划中所有的点(按照planId查询返回)
* **********/
/// &summary&
/// 删除一个节点
/// &/summary&
/// &param name=&planId&&&/param&
public static void deleteOnePlan(string planId)
//xml的加载
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&plan.xml&);
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&Settings&).ChildN
XmlNode root = xmlDocument.SelectSingleNode(&Settings&);
//找到并删除节点
for (int i = 0; i & nodeList.C i++)
XmlNodeList childNode = nodeList[i].ChildN
XmlElement xe1 = nodeList[i] as XmlE
if (xe1.GetAttribute(&key&) == planId)
root.RemoveChild(nodeList[i]);
xmlDocument.Save(&plan.xml&);
xmlDocument.Save(&plan.xml&);
/// &summary&
/// 添加一个网管配置方案
/// &/summary&
/// &param name=&planId&&&/param&
public static void addOnePlan(string planId)
//xml的加载
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&plan.xml&);
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&Settings&).ChildN
XmlNode root = xmlDocument.SelectSingleNode(&Settings&);
//向xml中插入一个节点
for (int i = 0; i & nodeList.C i++)
XmlNodeList childNode = nodeList[i].ChildN
XmlElement xe1 = nodeList[i] as XmlE
if (xe1.GetAttribute(&key&) == planId)
root.RemoveChild(nodeList[i]);
xmlDocument.Save(&plan.xml&);
XmlElement xe = xmlDocument.CreateElement(&appSettings&);
xe.SetAttribute(&key&, planId);
root.AppendChild(xe);
xmlDocument.Save(&plan.xml&); ;
/// &summary&
/// 返回所有的方案列表
/// &/summary&
/// &returns&所有的方案列表&/returns&
public static List&PlanNodeWithName& getAllPlan()
List&PlanNodeWithName& planNodeListArray = new List&PlanNodeWithName&();
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&plan.xml&);
List&PlanNode& planNodeList =
PlanNode pn =
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&Settings&).ChildN
XmlNode root = xmlDocument.SelectSingleNode(&Settings&);
for (int i = 0; i & nodeList.C i++)
XmlNodeList childNode = nodeList[i].ChildN
planNodeList = new List&PlanNode&();
XmlElement xe1 = nodeList[i] as XmlE
foreach (XmlNode xn in childNode)
XmlElement xe = xn as XmlE
//&add networkId=&OPM00001& nodeId=&08.08.01& relayId=&08.08.01& /&
pn = new PlanNode(xe.GetAttribute(&networkId&), xe.GetAttribute(&nodeId&), xe.GetAttribute(&relayId&));
planNodeList.Add(pn);
planNodeListArray.Add(new PlanNodeWithName(xe1.GetAttribute(&key&),planNodeList,xe1.GetAttribute(&time&)));
return planNodeListA
/// &summary&
/// 根据Id号获取该分组中所有的NodeList(方便离线加载)
/// &/summary&
/// &param name=&planId&&&/param&
public static List&PlanNode& getSiglePlan(string planId)
//xml的加载
List&PlanNode& planNodeList = new List&PlanNode&();
PlanNode pn =
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&plan.xml&);
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&Settings&).ChildN
XmlNode root = xmlDocument.SelectSingleNode(&Settings&);
//获取一个列表中的节点
for (int i = 0; i & nodeList.C i++)
XmlNodeList childNode = nodeList[i].ChildN
XmlElement xe1 = nodeList[i] as XmlE
if (xe1.GetAttribute(&key&) == planId)
foreach (XmlNode xn in childNode)
XmlElement xe = xn as XmlE
pn = new PlanNode(xe.GetAttribute(&networkId&), xe.GetAttribute(&nodeId&), xe.GetAttribute(&relayId&));
planNodeList.Add(pn);
return planNodeL
//将拍照时间加入计划表
public static void editPlanTime(PlanNodeWithName pw)
//xml的加载
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&plan.xml&);
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&Settings&).ChildN
XmlNode root = xmlDocument.SelectSingleNode(&Settings&);
for (int i = 0; i & nodeList.C i++)
XmlNodeList childNode = nodeList[i].ChildN
XmlElement xe1 = nodeList[i] as XmlE
if (xe1.GetAttribute(&key&) == pw.planName)
xe1.SetAttribute(&time&,pw.shotTime);
xmlDocument.Save(&plan.xml&);
public static void editPlan(PlanNodeWithName pw)
//xml的加载
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&plan.xml&);
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&Settings&).ChildN
XmlNode root = xmlDocument.SelectSingleNode(&Settings&);
//向xml中插入一个节点
for (int i = 0; i & nodeList.C i++)
XmlNodeList childNode = nodeList[i].ChildN
XmlElement xe1 = nodeList[i] as XmlE
if (xe1.GetAttribute(&key&) == pw.planName)
//先将已有的移除
xe1.RemoveAll();
xe1.SetAttribute(&key&,pw.planName);
xe1.SetAttribute(&time&, pw.shotTime);
//将计划表添加到xml中
foreach (PlanNode pn in pw.planNodeList)
XmlElement add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&networkId&, pn.networkID);
add.SetAttribute(&nodeId&, pn.nodeId);
add.SetAttribute(&relayId&,pn.relayId);
xe1.AppendChild(add);
xmlDocument.Save(&plan.xml&);
#endregion
#region 网管网络部分配置
/// &summary&
/// 返回单个节点的值
/// &/summary&
/// &param name=&value&&值&/param&
/// &returns&&/returns&
private static string getSingalConfig(string value)
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&config.xml&);
XmlNode xmlNode = xmlDocument.SelectSingleNode(&appSettings&);
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&Settings/appSettings&).ChildN
foreach (XmlNode xn in nodeList)
XmlElement xe = xn as XmlE
if (xe.GetAttribute(&key&) == value)
return xe.GetAttribute(&value&);
//读取配置参数
/// &summary&
/// 配置单个节点xml配置
/// &/summary&
/// &param name=&key&&app.config中key的值&/param&
/// &param name=&value&&app.config中value的值&/param&
private static void setNode(string key, string value)
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&config.xml&);
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&appSettings&).ChildN
foreach (XmlNode xn in nodeList)
XmlElement xe = xn as XmlE
if (xe.GetAttribute(&key&) == key)
xe.SetAttribute(&value&, value);
xmlDocument.Save(&config.xml&);
/// &summary&
/// 获取心跳值
/// &/summary&
public static void getHeartbeatInterval()
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&config.xml&);
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&HeartbeatInterval&).ChildN
XmlElement xe = nodeList[0] as XmlE
Global.HeartBeatInterval = int.Parse(xe.GetAttribute(&value&));
/// &summary&
/// 读取全部配置
/// &/summary&
public static void
readAllXMLConfig()
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&config.xml&);
SetttingFactory sf=// = new SetttingFactory();
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&Settings&).ChildN
Global.setting_list.Clear();
foreach (XmlNode xn2 in nodeList)
sf = new SetttingFactory();
XmlElement xe=xn2 as XmlE
XmlNodeList xnl = xe.ChildN
sf.isConfig = xe.GetAttribute(&value&);
xe = xnl[1] as XmlE
sf.passcode = xe.GetAttribute(&value&);
xe = xnl[2] as XmlE
sf.serverIp = xe.GetAttribute(&value&);
xe = xnl[3] as XmlE
sf.serverPort = xe.GetAttribute(&value&);
xe = xnl[4] as XmlE
sf.opmServerIp = xe.GetAttribute(&value&);
xe = xnl[5] as XmlE
sf.opmServerPort = xe.GetAttribute(&value&);
xe = xnl[6] as XmlE
sf.lighetNetworkId = xe.GetAttribute(&value&);
xe = xnl[7] as XmlE
sf.networkId = xe.GetAttribute(&value&);
xe = xnl[8] as XmlE
sf.basepath = xe.GetAttribute(&value&);
xe = xnl[9] as XmlE
sf.webServiceIP = xe.GetAttribute(&value&);
xe = xnl[10] as XmlE
sf.webServicePort = xe.GetAttribute(&value&);
xe = xnl[11] as XmlE
sf.messageSet = xe.GetAttribute(&value&);
Global.setting_list.Add(sf);
/// &summary&
/// 删除一个节点配置
/// &/summary&
/// &param name=&NetworkId&&&/param&
/// &param name=&address&&&/param&
/// &returns&&/returns&
public static bool delChildNode(string NetworkId,string address)
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&config.xml&);
//首先判断ipAddress 和opmNetwork是否存在于列表中
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&Settings&).ChildN
XmlNode root = xmlDocument.SelectSingleNode(&Settings&);
int rootIndex = -1;
for (int i = 0; i & nodeList.C i++)
XmlNodeList childNode = nodeList[i].ChildN
for (int j = 0; j & childNode.C j++)
XmlNode xn = childNode[j];
XmlElement xe1 = xn as XmlE
if (xe1.GetAttribute(&OpmMgtServerIP&) == address && xe1.GetAttribute(&NetworkId&) == NetworkId)
//修改配置 存在则删除配置
rootIndex =
root.RemoveChild(nodeList[i]);
xmlDocument.Save(&config.xml&);
/// &summary&
/// 根据networkId进行删除
/// &/summary&
/// &param name=&networkId&&&/param&
public static void deleteOneNode(string networkId, string opmMgtTcpIP)
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&config.xml&);
//首先判断ipAddress 和opmNetwork是否存在于列表中
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&Settings&).ChildN
XmlNode root = xmlDocument.SelectSingleNode(&Settings&);
int rootIndex = -1;
for (int i = 0; i & nodeList.C i++)
XmlNodeList childNode = nodeList[i].ChildN
XmlElement xe1 =
childNode.Item(4) as XmlE
XmlElement xe2 = childNode.Item(7) as XmlE
if (xe1.GetAttribute(&value&) == opmMgtTcpIP && xe2.GetAttribute(&value&) == networkId)
//修改配置 存在则删除配置
rootIndex =
root.RemoveChild(nodeList[i]);
xmlDocument.Save(&config.xml&);
/// &summary&
/// 写配置
/// &/summary&
/// &param name=&isConfig&&&/param&
/// &param name=&passcode&&安全识别码&/param&
/// &param name=&serverIp&&&/param&
/// &param name=&serverport&&&/param&
/// &param name=&opmMgtTcpIP&&&/param&
/// &param name=&opmMgtTcpPort&&&/param&
/// &param name=&lightNetworkId&&&/param&
/// &param name=&NetworkId&&&/param&
/// &param name=&basePath&&&/param&
/// &param name=&webserviceIp&&&/param&
/// &param name=&webservicePort&&&/param&
/// &param name=&messageSet&&&/param&
public static void addOrEidtChildNode(string isConfig, string passcode, string serverIp, string serverport, string opmMgtTcpIP, string opmMgtTcpPort, string lightNetworkId, string NetworkId, string basePath, string webserviceIp, string webservicePort, string messageSet)
XmlDocument xmlD
xmlDocument = new XmlDocument();
xmlDocument.Load(&config.xml&);
//首先判断ipAddress 和opmNetwork是否存在于列表中
XmlNodeList nodeList = xmlDocument.SelectSingleNode(&Settings&).ChildN
XmlNode root = xmlDocument.SelectSingleNode(&Settings&);
int rootIndex = -1;
for (int i = 0; i & nodeList.C i++)
XmlNodeList childNode = nodeList[i].ChildN
XmlElement xe1 = childNode.Item(4) as XmlE
XmlElement xe2 = childNode.Item(7) as XmlE
if (xe1.GetAttribute(&value&) == opmMgtTcpIP && xe2.GetAttribute(&value&) == NetworkId)
//修改配置 存在则删除配置
rootIndex =
root.RemoveChild(nodeList[i]);
xmlDocument.Save(&config.xml&);
//写新配置
// XmlNode root = xmlDocument.SelectSingleNode(&Settings&);
XmlElement xe = xmlDocument.CreateElement(&appSettings&);
XmlElement add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &isConfig&);
add.SetAttribute(&value&, isConfig);
xe.AppendChild(add);
add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &PassCode&);
add.SetAttribute(&value&, passcode);
xe.AppendChild(add);
add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &ServerIP&);
add.SetAttribute(&value&, serverIp);
xe.AppendChild(add);
add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &ServerPort&);
add.SetAttribute(&value&, serverport);
xe.AppendChild(add);
add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &OpmMgtServerIP&);
add.SetAttribute(&value&, opmMgtTcpIP);
xe.AppendChild(add);
add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &OpmMgtTcpPort&);
add.SetAttribute(&value&, opmMgtTcpPort);
xe.AppendChild(add);
add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &LightNetworkId&);
add.SetAttribute(&value&, lightNetworkId);
xe.AppendChild(add);
add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &NetworkId&);
add.SetAttribute(&value&, NetworkId);
xe.AppendChild(add);
add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &basePath&);
add.SetAttribute(&value&, basePath);
xe.AppendChild(add);
add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &webserviceIP&);
add.SetAttribute(&value&, webserviceIp);
xe.AppendChild(add);
add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &webServicePort&);
add.SetAttribute(&value&, webservicePort);
xe.AppendChild(add);
add = xmlDocument.CreateElement(&add&);
add.SetAttribute(&key&, &messageSet&);
add.SetAttribute(&value&, messageSet);
xe.AppendChild(add);
root.AppendChild(xe);
xmlDocument.Save(&config.xml&); ;
public static string LoadBasePath()
string str1 = ConfigurationManager.AppSettings.Get(&basePath&);
string str1 = getSingalConfig(&basePath&);
if (str1 == && || str1 == null)
return &D:/OPMPicture&;
return str1;
public static void LoadIsConfig()
string str1 = ConfigurationManager.AppSettings.Get(&isConfig&);
string str1 = getSingalConfig(&isConfig&);
int res = -1;
res = Convert.ToInt32(str1);
catch (Exception)
Global.isLoadConfig =//只有当res=1时候才表示配置成功
#endregion
#region 第一版本的配置 放在app.config中的
/// &summary&
/// 将是否请求webservice标志位置为1
/// &/summary&
public static void SetIsConfig()
ConfigurationManager.AppSettings.Set(&isConfig&,&1&);
setNode(&isConfig&, &1&);
Global.isLoadConfig = 1;
public static void LoadWebServiceConfig()
// string str1 = ConfigurationManager.AppSettings.Get(&webserviceIP&);
string str1 = getSingalConfig(&webserviceIP&);
string str2 = getSingalConfig(&webServicePort&);
string str3 = getSingalConfig(&messageSet&);
string str2 = ConfigurationManager.AppSettings.Get(&webServicePort&);
string str3 = ConfigurationManager.AppSettings.Get(&messageSet&);
if (str1 != null)
Global.webServiceIp = str1;
if (str2 != null)
Global.webServicePort = str2;
if (str3 != null)
Global.messageSet = str3;
/// &summary&
/// 为需要请求的webservice端配置ip,port,messageset
/// &/summary&
/// &param name=&ip&&webservice端的ip&/param&
/// &param name=&port&&webservice端的port&/param&
/// &param name=&messageSet&&需要请求的消息级(如灯控摄像,等等)&/param&
public static void SetWebServiceConfig(string ip, string port, string messageSet)
setNode(&webserviceIP&, ip);
setNode(&webServicePort&, port);
setNode(&messageSet&, messageSet);
Global.webServiceIp =
Global.webServicePort =
Global.messageSet = messageS
/// &summary&
/// 更新配置
配置客户端的基础参数 。包括请求的ip地址,本地服务地址,安全识别码,使用协议等
/// &/summary&
/// &param name=&isLoadConfig&&是否已写配置程序加载时候有用.1表示已配置 其他未配置&/param&
/// &param name=&secureCode&&安全识别码&/param&
/// &param name=&serverIp&&本机ip&/param&
/// &param name=&serverPort&&本机端口&/param&
/// &param name=&remoteServerIp&&远端服务ip&/param&
/// &param name=&remoteServerPort&&远端端口&/param&
/// &param name=&lightNetworkId&&灯控网络好&/param&
/// &param name=&networkId&&OPM网络号&/param&
/// &param name=&messageSet&&数据集&/param&
public static void SetAllConfig(int isLoadConfig, string secureCode, string serverIp, string serverPort, string remoteServerIp, string remoteServerPort, string lightNetworkId, string networkId, string messageSet)
Global.isLoadConfig = 1;
setNode(&isConfig&, isLoadConfig.ToString());
setNode(&PassCode&, secureCode);
setNode(&ServerIP&, serverIp);
setNode(&ServerPort&, serverPort);
setNode(&OpmMgtServerIP&, remoteServerIp);
setNode(&OpmMgtTcpPort&, remoteServerPort);
setNode(&LightNetworkId&, lightNetworkId);
setNode(&NetworkId&, networkId);
setNode(&messageSet&, messageSet);
Global.PassCode = secureC
Global.ServerIP = serverIp;
if (serverPort == null || serverPort == &&)
{ Global.ServerPort = 0; }
Global.ServerPort = Convert.ToInt32(serverPort);
if (remoteServerPort == && || remoteServerPort == null)
{ Global.OpmMgtTcpPort = 0; }
Global.OpmMgtTcpPort = Convert.ToInt32(remoteServerPort);
Global.webServiceIp = remoteServerP
Global.NetworkId = networkId;
Global.LightNetworkId = lightNetworkId;
Global.messageSet = messageS
/// &summary&
/// 加载通用配置项
/// &/summary&
public static void Load()
string str1 = getSingalConfig(&PassCode&);
string str2 = getSingalConfig(&ServerIP&);
string str3 = getSingalConfig(&ServerPort&);
string str4 = getSingalConfig(&OpmMgtServerIP&);
string str5 = getSingalConfig(&OpmMgtTcpPort&);
string str6 = getSingalConfig(&LightNetworkId&);
string str7 = getSingalConfig(&NetworkId&);
string str8 = getSingalConfig(&messageSet&);
if (null != str1)
Global.PassCode = str1;
if (null != str2)
Global.ServerIP = str2;
if (null != str3 && str3 != &&)
Global.ServerPort = int.Parse(str3);
if (null != str4)
Global.OpmMgtServerIP = str4;
if (null != str5 && str5 != &&)
Global.OpmMgtTcpPort = int.Parse(str5);
if (null != str6)
Global.LightNetworkId = str6;
if (null != str7)
Global.NetworkId = str7;
if (str8 != null)
Global.messageSet = str8;
#endregion
Index: UserDefineDataType.cs
===================================================================
--- UserDefineDataType.cs (revision 0)
+++ UserDefineDataType.cs (revision 2)
@@ -0,0 +1,459 @@
+using System.Collections.G
+using System.L
+using System.T
+using System.N
+namespace OmeshNetwork.Tool
public class OPMAddRssi
public byte Rssi { }
public byte[] OpmAdd { }
public class MessageToSend
private byte[]
private IPEndPoint targetEP;
private Int16 seqN
public byte[] Data
get { return this. }
set { this.data = }
public Int16 SeqNum
get { return this.seqN }
set { this.seqNum = }
public IPEndPoint TargetEP
get { return this.targetEP; }
set { this.targetEP = }
public enum BaudRate
b_9600 = 0x00,
b_14400 = 0x01,
b_28800 = 0x02,
b_57600 = 0x03,
b_115200 = 0x04,
b_230400 = 0x05,
b_460800 = 0x06,
b_921600 = 0x07
//灯控传输交互指令类型
public enum LightNetConvRequestType
//通用转发请求指令
CommonConvRequest = 0x01,
//追加网络请求指令
CommonAddNetRequest = 0x05,
//删除网络请求指令
CommonDelNetRequest = 0x07,
//灯控传输交互响应类型
public enum LightNetConvResponseType
//通用转发响应指令
CommonConvResponse = 0x02,
//路灯心跳响应指令
CommonLightBeatResponse = 0x04,
//追加网络响应指令
CommonAddNetResponse = 0x06,
//删除网络响应指令
CommonDelNetResponse = 0x08,
//灯控WEB请求消息类型
public enum LightNetWebResquestType
//分组路灯开启指令
OpenGroupLightRequest = 0x01,
//多个路灯开启指令
OpenMostLightRequest = 0x02,
//分组路灯关闭指令
CloseGroupLightRequest = 0x03,
//多个路灯关闭指令
CloseMostLightRequest = 0x04,
//分组路灯亮度调节指令
AdjustGroupLightRequest = 0x05,
//多个路灯亮度调节指令
AdjustMostLightRequest = 0x06,
//分组路灯状态获取指令
GetGroupLightRequest = 0x07,
//多个路灯状态获取指令
GetMostLightRequest = 0x08,
//Web网络添加指令
AddNetworkWebRequest = 0x09,
//Web网络删除指令
DeleteNetworkWebRequest = 0x0a,
//单个路灯开启指令
OpenLightRequest = 0x0b,
//单个路灯关闭指令
CloseLightRequest = 0x0c,
//单个路灯调节指令
AdjustLightRequest = 0x0d,
//单个路灯状态获取指令
GetLightRequest = 0x0e,
//单个路灯参数设置请求指令
LightConfigRequest = 0x0f,
//多个路灯参数设置请求指令
MostLightConfigRequest = 0x10,
//分组路灯参数设置请求指令
GroupLightConfigRequest = 0x11
//灯控管理请求消息类型
public enum LightMngRequestMsgType
//多个路灯开启指令
OpenMostLightRequest = 0x01,
//多个路灯关闭指令
CloseMostLightRequest = 0x03,
//多个路灯亮度调节指令
AdjustMostLightRequest = 0x05,
//多个路灯关闭指令
GetMostLightRequest = 0x07,
//单个路灯开启指令
OpenLightRequest = 0x51,
//单个路灯关闭指令
CloseLightRequest = 0x53,
//单个路灯亮度调节指令
AdjustLightRequest = 0x55,
//单个路灯关闭指令
GetLightRequest = 0x57,
//单个路灯参数设置请求指令
LightConfigRequest = 0x5a,
///多个路灯参数设置请求指令
MostLightConfigRequest = 0x09,
//灯控管理响应消息类型
public enum LightMngResponseMsgType
//多个路灯开启响应指令
OpenMostLightResponse = 0x02,
//多个路灯关闭响应指令
CloseMostLightResponse = 0x04,
//多个路灯亮度调节响应指令
AdjustMostLightResponse = 0x06,
//多个路灯状态获取指令
GetMostLightResponse = 0x08,
//单个路灯开启响应指令
OpenLightResponse = 0x52,
//单个路灯关闭响应指令
CloseLightResponse = 0x54,
//单个路灯亮度调节响应指令
AdjustLightResponse = 0x56,
//单个路灯状态获取指令
GetLightResponse = 0x58,
//路灯状态心跳指令
LightHeartBeatResponse = 0x59,
//单个路灯参数设置响应指令
LightConfigRequest = 0x5b,
///多个路灯参数设置响应指令
MostLightConfigRequest = 0x0a,
//组网消息类型
public enum NetworkInitMessageType
//网关初始化请求
GatewayInitiateRequest = 0x01,
//固定设备注册请求
FixedDeviceRegisterRequest = 0x09,
//OPM地址发行请求
OPMAddressConfigRequest = 0x07,
//移动设备注册请求
MobileDeviceRegisterRequest = 0x0b,
//心跳请求
Heartbeat = 0x0d
//Web指令消息类型
public enum NetworkWebCmdMessageType
//获取硬件配置指令
ReadHardwareConfigWebCmd = 0x01,
//更新配置指令
UpdateHardwareConfigWebCmd = 0x03,
//获取网络监控数据指令
ReadNetworkDataWebCmd = 0x05,
//刷机指令
UpgradeWebCmd = 0x07,
//刷机数据
UpdateData = 0x09,
//通信能力测试指令
CommunicationCapabilityWebCmd = 0x0a,
//信号强度测试指令
RssiTestWebCmd = 0x10,
//测试停止指令
StopTestWebCmd = 0x14,
//设备重启指令
ResetWebCmd = 0xf1,
ClearPreviousAddressWebCmd = 0xf2,
ClearStasticsWebCmd = 0xf3,
//Calibrate指令
CalibrateWebCmd = 0xf4,
//获取Calibration指令
ReadCalibrationWebCmd = 0x17
//网络管理消息类型
public enum NetworkMngtMessageType
//获取硬件配置指令结果
ReadHardwareConfigCmdResult = 0x02,
//更新配置指令结果
UpdateHardwareConfigCmdResult = 0x04,
//获取网络监控数据指令结果
ReadNetworkDataCmdResult = 0x06,
//刷机指令结果
UpgradeCmdResult = 0x08,
//通信能力测试指令结果
CommunicationCapabilityCmdResult = 0x0b,
//测试报告结果
TestReportCmdResult = 0x0e,
//信号强度测试指令结果
RssiTestCmdResult = 0x11,
//通用配置指令结果
CommonConfigCmdResult = 0x16,
//获取Calibration指令结果
ReadCalibrationCmdResult = 0x18
//通用配置消息类型
public enum CommonConfigurationMessageType
//获取Host OPM参数请求
GetHostOPMParamRequest = 0x01,
//获取Host OPM参数响应
GetHostOPMParamResponse = 0x02,
//获取Target OPM参数请求
GetTargetOPMParamRequest = 0x03,
//获取Target OPM参数响应
GetTargetOPMParamResponse = 0x04,
//设置Host OPM参数请求
SetHostOPMParamRequest = 0x05,
//设置Host OPM参数响应
SetHostOPMParamResponse = 0x06,
//设置Target OPM参数请求
SetTargetOPMParamRequest = 0x0A,
//设置Target OPM参数响应
SetTargetOPMParamResponse = 0x0B,
//查找Host周围OPM设备请求
SearchHostAroundOPMDeviceRequest = 0x0C,
//Host回复PC 查找Host周围OPM设备响应
SearchHostAroundOPMDeviceResponse = 0x0D
public enum MessageSet
NetworkInitiate = 0x00,
//网络管理
NetworkManagement = 0x03,
//通用配置指令
CommonConfiguration = 0x10,
NetworkWebCmd = 0xff,
//灯控通用传输指令
LightNetConversation = 0xe1,
//灯控WEB管理请求
LightNetWebRequest = 0xe2,
//灯控管理指令
LightNetManagement = 0x05,
//响应结果
public enum CauseCode
#region 与协议对应
Success = 0x00,
Failure = 0x01,
//UnknowDevice = 0x01,
NoAddressAvailable = 0x02,
ReceiveModeEnableFailed = 0x03,
UpgradeDataSuccess = 0x04,
ReUpgradeData = 0x05,
StopUpgradeData = 0x06,
#endregion
#region 网络安全Code验证
SecureCodeCheckOK = 0xf0,
SecureCodeCheckNoData = 0xf1,
SecureCodeCheckNG = 0xf2,
SecureCodeCheckAdded = 0xf3,
#endregion
//节点类型
public enum NodeType
Gateway = 0x00,
Node = 0x01,
//网关以网点身份注册
NodeGateway = 0x02,
//双向型移动点
TwoWayMovePoint = 0x03,
//单传型移动点
SingleMovePoint = 0x04,
//直传型移动点
DirectMovePoint = 0x05
//设备类型
public enum DeviceType
Gateway = 00,
Node = 01,
//移动设备
Mobile = 09
//设备组网状态
public enum DeviceState
RegisterSucceed,
RegisterFailed,
Initiated,
Undefined,
VerificationFailed,
OPMAddressConfigFailed,
OPMAddressConfiged
//心跳类型
public enum HeartbeatType
Normal = 0x00
public struct Flag
public byte CTRT { }
public byte BackOff { }
public byte PreviousAddress { }
public byte PowerSave { }
public byte Query { }
public byte Channel { }
public byte Braodcast { }
public class OPMAddressRssiVersion :IComparable
public String OPMAddress { }
public String Rssi { }
public String Version { }
public OPMAddressRssiVersion()
OPMAddress =
#region IComparable 成员
public int CompareTo(object obj)
if (obj is OPMAddressRssiVersion)
OPMAddressRssiVersion tempStudent = obj as OPMAddressRssiV
int iRssi = Convert.ToInt32(this.Rssi);
int iRssi2 = Convert.ToInt32(tempStudent.Rssi);
pareTo(iRssi2);
throw new NotImplementedException(&obj is not a OPMAddressRssiVersion!&);
#en

我要回帖

更多关于 point and shoot 的文章

 

随机推荐