public string F_HW_ConfigResp_DataToHex(string F_ICD, bool reply, byte precTimeEnabled, byte precTimeDir, byte freqAidEnabled, byte freqAidMethod, byte rtcAvailble, byte rtcSrc, byte coarseTimeEnabled, byte refClkEnabled, long normFreq) { string str; ArrayList fieldList = new ArrayList(); if (!reply) { str = this.F_Reject(F_ICD, this.F_ID_HW_CONFIG, 4); } else { fieldList = utils_AutoReply.GetMessageStructure(base.ProtocolFile, CommunicationManager.ReceiverType.SLC, this.F_ID_HW_CONFIG, 0, this.F_PROTOCOL_NAME, F_ICD); int num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "HW_CONFIG")) { num++; } byte num2 = (byte)(((((((precTimeEnabled | (precTimeDir << 1)) | (freqAidEnabled << 2)) | (freqAidMethod << 3)) | (rtcAvailble << 4)) | (rtcSrc << 5)) | (coarseTimeEnabled << 6)) | (refClkEnabled << 7)); SLCMsgStructure structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = num2.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "NOMINAL_FREQ")) { num++; } structure = (SLCMsgStructure)fieldList[num]; long num3 = normFreq * 0x3e8L; structure.defaultValue = (num3 & 0xffffffffffL).ToString(); fieldList[num] = structure; str = utils_AutoReply.FieldList_to_HexString(true, fieldList, this.F_MSG_TYPE); } fieldList.Clear(); return(str); }
public string F_Reject(string F_ICD, byte msgID, byte reason) { ArrayList fieldList = new ArrayList(); fieldList = utils_AutoReply.GetMessageStructure(base.ProtocolFile, CommunicationManager.ReceiverType.SLC, this.F_ID_REJECT, 0, this.F_PROTOCOL_NAME, F_ICD); int num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "REJ_MESS_ID")) { num++; } SLCMsgStructure structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = msgID.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "REJ_REASON")) { num++; } structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = reason.ToString(); fieldList[num] = structure; string str = utils_AutoReply.FieldList_to_HexString(true, fieldList, this.F_MSG_TYPE); fieldList.Clear(); return(str); }
internal QoSSetting getQoSSettings(string icdStr) { QoSSetting setting = new QoSSetting(); ArrayList list = new ArrayList(); list = this.SLC_GetMessageStructure(1, 0, "AI3", "2.2"); for (int i = 0; i < 11; i++) { SLCMsgStructure structure = (SLCMsgStructure)list[i]; switch (structure.fieldName) { case "ICD_REV_NUM": setting.ICDSTR = icdStr; break; case "POS_REQ_FLAG": setting.PosReqType = structure.defaultValue; break; case "NUM_FIXES": setting.NumFixes = structure.defaultValue; break; case "TIME_BTW_FIXES": setting.TBFixes = structure.defaultValue; break; case "HORI_ERROR_MAX": setting.Position2DError = structure.defaultValue; break; case "VERT_ERROR_MAX": setting.Position3DError = structure.defaultValue; break; case "RESP_TIME_MAX": setting.RespTMax = structure.defaultValue; break; case "TIME_ACC_PRIORITY": setting.TAccPriority = structure.defaultValue; break; case "LOCATION_METHOD": setting.LocMethod = structure.defaultValue; break; case "ALM_REQ_FLAG": setting.AlmReqFlag = structure.defaultValue; break; } } list.Clear(); setting.IsInit = true; return(setting); }
public string OSPHWConfigRespDataToHex(string osp_ICD, byte precTimeEnabled, byte precTimeDir, byte freqAidEnabled, byte freqAidMethod, byte rtcAvailble, byte rtcSrc, byte coarseTimeEnabled, byte refClkEnabled, long normFreq, byte networkEnhanceType) { ArrayList fieldList = new ArrayList(); fieldList = utils_AutoReply.GetMessageStructure(base.ProtocolFile, CommunicationManager.ReceiverType.OSP, 0xd6, 0, "OSP", osp_ICD); int num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "HW_CONFIG")) { num++; } byte num2 = (byte)(((((((precTimeEnabled | (precTimeDir << 1)) | (freqAidEnabled << 2)) | (freqAidMethod << 3)) | (rtcAvailble << 4)) | (rtcSrc << 5)) | (coarseTimeEnabled << 6)) | (refClkEnabled << 7)); SLCMsgStructure structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = num2.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "NOMINAL_FREQ")) { num++; } structure = (SLCMsgStructure)fieldList[num]; if ((freqAidEnabled == 1) && (freqAidMethod == 0)) { long num3 = normFreq * 0x3e8L; structure.defaultValue = (num3 & 0xffffffffffL).ToString(); } else { structure.defaultValue = "0000000000"; } fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "NW_ENHANCE_TYPE")) { num++; } structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = networkEnhanceType.ToString(); fieldList[num] = structure; string str = utils_AutoReply.FieldList_to_HexString(false, fieldList, 0); fieldList.Clear(); return(str); }
public override string AutoSendPositionRequestMsg() { ArrayList fieldList = new ArrayList(); fieldList = utils_AutoReply.GetMessageStructure(base.ProtocolFile, CommunicationManager.ReceiverType.OSP, 210, 0, "OSP", base.ControlChannelVersion); for (int i = 0; i < fieldList.Count; i++) { SLCMsgStructure structure = (SLCMsgStructure)fieldList[i]; switch (structure.fieldName) { case "NUM_FIXES": structure.defaultValue = base.PositionRequestCtrl.NumFixes.ToString(); break; case "TIME_BTW_FIXES": structure.defaultValue = base.PositionRequestCtrl.TimeBtwFixes.ToString(); break; case "HORI_ERROR_MAX": structure.defaultValue = base.PositionRequestCtrl.HorrErrMax.ToString(); break; case "VERT_ERROR_MAX": structure.defaultValue = base.PositionRequestCtrl.VertErrMax.ToString(); break; case "RESP_TIME_MAX": structure.defaultValue = base.PositionRequestCtrl.RespTimeMax.ToString(); break; case "TIME_ACC_PRIORITY": structure.defaultValue = base.PositionRequestCtrl.TimeAccPriority.ToString(); break; case "LOCATION_METHOD": structure.defaultValue = base.PositionRequestCtrl.LocMethod.ToString(); break; } fieldList[i] = structure; } base.PositionRequestMsg = utils_AutoReply.FieldList_to_HexString(false, fieldList, 0); fieldList.Clear(); return(base.PositionRequestMsg); }
public ArrayList SLC_GetMessageStructure(int mid, int sid, string protocol, string version) { ArrayList list = new ArrayList(); SLCMsgStructure structure = new SLCMsgStructure(); int num = 0; XPathExpression expr = this.m_XPathNav.Compile(string.Concat(new object[] { "/protocols/protocol[@name='", protocol, "'][@version='", version, "']/message[@mid='", mid, "'][@subid = '']/field" })); XPathNodeIterator iterator = this.m_XPathNav.Select(expr); if (iterator.Count == 0) { expr = this.m_XPathNav.Compile(string.Concat(new object[] { "/protocols/protocol[@name='", protocol, "'][@version='", version, "']/message[@mid='", mid, "'][@subid = '", sid, "']/field" })); iterator = this.m_XPathNav.Select(expr); } try { while (iterator.MoveNext()) { XPathNavigator navigator = iterator.Current.Clone(); structure.fieldNumber = iterator.CurrentPosition; structure.fieldName = navigator.GetAttribute("name", ""); structure.bytes = int.Parse(navigator.GetAttribute("bytes", "")); structure.datatype = navigator.GetAttribute("datatype", ""); structure.units = navigator.GetAttribute("units", ""); if (navigator.GetAttribute("scale", "") == "") { structure.scale = 1.0; } else { structure.scale = double.Parse(navigator.GetAttribute("scale", "")); } structure.startByte = (((this.m_MsgHeaderSize + this.m_MsgPayloadSize) + this.m_MsgChannelSize) + 1) + num; structure.endByte = (structure.startByte + structure.bytes) - 1; structure.defaultValue = navigator.GetAttribute("default", ""); num += structure.bytes; list.Add(structure); } } catch (Exception exception) { throw exception; } return(list); }
internal static string getAlmFromFileForSet(string alm_Path) { if (!File.Exists(alm_Path)) { return(""); } string inputMsgFile = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\protocols\Protocols.xml"; ArrayList fieldList = new ArrayList(); fieldList = GetMessageStructure(inputMsgFile, CommunicationManager.ReceiverType.GSW, 130, -1, "SSB", "1.6"); StreamReader reader = File.OpenText(alm_Path); string str2 = ""; new Regex("[0-9]+,"); for (int i = 0; i < 5; i++) { str2 = reader.ReadLine(); } string str3 = "130,"; while (((str2 = reader.ReadLine()) != null) && !str2.Contains("End of File")) { str3 = str3 + str2 + ","; } string[] strArray = str3.Split(new char[] { ',' }); for (int j = 0; j < strArray.GetLength(0); j++) { if (strArray[j] != string.Empty) { SLCMsgStructure structure = (SLCMsgStructure)fieldList[j]; structure.defaultValue = strArray[j]; fieldList[j] = structure; } } string str4 = FieldList_to_HexString(false, fieldList, 0); reader.Close(); return(str4); }
internal static string getEphFromFileForSet(string eph_Path) { if (!File.Exists(eph_Path)) { return(""); } string inputMsgFile = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\protocols\Protocols.xml"; ArrayList fieldList = new ArrayList(); fieldList = GetMessageStructure(inputMsgFile, CommunicationManager.ReceiverType.GSW, 0x95, -1, "SSB", "1.6"); StreamReader reader = File.OpenText(eph_Path); string str2 = ""; new Regex("[0-9]+,"); for (int i = 0; i < 5; i++) { str2 = reader.ReadLine(); } StringBuilder builder = new StringBuilder(); while (((str2 = reader.ReadLine()) != null) && !str2.Contains("End of File")) { if (str2.Substring(0, 1) != "0") { string[] strArray = ("149," + str2).Split(new char[] { ',' }); for (int j = 0; j < strArray.GetLength(0); j++) { SLCMsgStructure structure = (SLCMsgStructure)fieldList[j]; structure.defaultValue = strArray[j]; fieldList[j] = structure; } builder.Append(FieldList_to_HexString(false, fieldList, 0) + ","); } } reader.Close(); return(builder.ToString()); }
public string OSPReject(string osp_ICD, byte msgID, byte msgSubID, byte reason) { ArrayList fieldList = new ArrayList(); fieldList = utils_AutoReply.GetMessageStructure(base.ProtocolFile, CommunicationManager.ReceiverType.OSP, 0xd8, 2, "OSP", osp_ICD); int num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "REJ_MESS_ID")) { num++; } SLCMsgStructure structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = msgID.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "REJ_MESS_SUB_ID")) { num++; } structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = msgSubID.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "REJ_REASON")) { num++; } structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = reason.ToString(); fieldList[num] = structure; string str = utils_AutoReply.FieldList_to_HexString(false, fieldList, 0); fieldList.Clear(); return(str); }
internal static ArrayList GetMessageStructure(string inputMsgFile, CommunicationManager.ReceiverType RxType, int mid, int sid, string protocol, string version) { XPathNavigator navigator = new XPathDocument(inputMsgFile).CreateNavigator(); int num = 2; int num2 = 2; int num3 = 0; if (RxType == CommunicationManager.ReceiverType.SLC) { num3 = 1; } ArrayList list = new ArrayList(); SLCMsgStructure structure = new SLCMsgStructure(); int num4 = 0; XPathExpression expr = navigator.Compile(string.Concat(new object[] { "/protocols/protocol[@name='", protocol, "'][@version='", version, "']/input/message[@mid='", mid, "'][@subid = '", sid, "']/field" })); XPathNodeIterator iterator = navigator.Select(expr); if (iterator.Count == 0) { expr = navigator.Compile(string.Concat(new object[] { "/protocols/protocol[@name='", protocol, "'][@version='", version, "']/input/message[@mid='", mid, "'][@subid = '']/field" })); iterator = navigator.Select(expr); } try { int num5 = 0; int num6 = 0; while (iterator.MoveNext()) { XPathNavigator navigator2 = iterator.Current.Clone(); if (navigator2.GetAttribute("name", "").Contains("LOOP")) { num5 = int.Parse(navigator2.GetAttribute("numloops", "")); num6 = int.Parse(navigator2.GetAttribute("numlines", "")); for (int i = 0; i < num5; i++) { for (int j = 0; j < num6; j++) { iterator.MoveNext(); navigator2 = iterator.Current.Clone(); structure.fieldNumber = iterator.CurrentPosition; structure.fieldName = navigator2.GetAttribute("name", ""); structure.bytes = int.Parse(navigator2.GetAttribute("bytes", "")); structure.datatype = navigator2.GetAttribute("datatype", ""); structure.units = navigator2.GetAttribute("units", ""); if (navigator2.GetAttribute("scale", "") == "") { structure.scale = 1.0; } else { structure.scale = double.Parse(navigator2.GetAttribute("scale", "")); } structure.startByte = (((num + num2) + num3) + 1) + num4; structure.endByte = (structure.startByte + structure.bytes) - 1; structure.defaultValue = navigator2.GetAttribute("default", ""); num4 += structure.bytes; list.Add(structure); } } } else { structure.fieldNumber = iterator.CurrentPosition; structure.fieldName = navigator2.GetAttribute("name", ""); structure.bytes = int.Parse(navigator2.GetAttribute("bytes", "")); structure.datatype = navigator2.GetAttribute("datatype", ""); structure.units = navigator2.GetAttribute("units", ""); if (navigator2.GetAttribute("scale", "") == "") { structure.scale = 1.0; } else { structure.scale = double.Parse(navigator2.GetAttribute("scale", "")); } structure.startByte = (((num + num2) + num3) + 1) + num4; structure.endByte = (structure.startByte + structure.bytes) - 1; structure.defaultValue = navigator2.GetAttribute("default", ""); num4 += structure.bytes; list.Add(structure); } } } catch (Exception exception) { throw exception; } return(list); }
public string AI3_ConvertInputDataToHex(string AI3_Version, int msgtype, int msgid, string EphSite, string gpsTimeStr) { StringBuilder builder = new StringBuilder(); builder.Append(msgtype.ToString()); builder.Append(","); builder.Append(msgid.ToString()); ArrayList list = new ArrayList(); list = this.SLC_GetMessageStructure(msgid, 0, "AI3", "2.2"); char[] separator = new char[] { ',' }; string[] strArray = new string[850]; string str = this.AI3_ReadEphFile_AllEph(EphSite, gpsTimeStr); if (str == "") { for (int k = 0; k < 800; k++) { strArray[k] = "0"; } } else { strArray = str.Split(separator); } int num2 = 0; if (AI3_Version == "2.1") { while ((num2 < list.Count) && (((SLCMsgStructure)list[num2]).fieldName != "ICD_REV_NUM")) { num2++; } SLCMsgStructure structure = (SLCMsgStructure)list[num2]; structure.defaultValue = "33"; list[num2] = structure; while ((num2 < list.Count) && (((SLCMsgStructure)list[num2]).fieldName != "HORI_ERROR_MAX")) { num2++; } SLCMsgStructure structure2 = (SLCMsgStructure)list[num2]; switch (structure2.defaultValue) { case "1": structure2.defaultValue = "0"; break; case "5": structure2.defaultValue = "1"; break; case "10": structure2.defaultValue = "2"; break; case "20": structure2.defaultValue = "3"; break; case "40": structure2.defaultValue = "4"; break; case "80": structure2.defaultValue = "5"; break; case "160": structure2.defaultValue = "6"; break; default: structure2.defaultValue = "7"; break; } list[num2] = structure2; } while ((num2 < list.Count) && (((SLCMsgStructure)list[num2]).fieldName != "1st EPH_FLAG")) { num2++; } int num3 = num2; for (int i = 0; num3 < (num2 + strArray.GetLength(0)); i++) { SLCMsgStructure structure3 = (SLCMsgStructure)list[num3]; structure3.defaultValue = strArray[i]; list[num3] = structure3; num3++; } for (int j = 0; j < list.Count; j++) { if (string.IsNullOrEmpty(((SLCMsgStructure)list[j]).defaultValue)) { builder.Append(",0"); } else { builder.Append(","); builder.Append(((SLCMsgStructure)list[j]).defaultValue); } } string str2 = this.AI3_Request_ConvertFieldsToRaw(builder.ToString()); list.Clear(); return(str2); }
public string F_TimeTransResp_DataToHex(string F_ICD, bool reject, byte ttType, ushort wkNum, ulong TOW, double acc) { string str; ArrayList fieldList = new ArrayList(); if (reject) { str = this.F_Reject(F_ICD, this.F_ID_TIME_TRANS, 4); } else { fieldList = utils_AutoReply.GetMessageStructure(base.ProtocolFile, CommunicationManager.ReceiverType.SLC, this.F_ID_TIME_TRANS, 0, this.F_PROTOCOL_NAME, F_ICD); int num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "TT_TYPE")) { num++; } SLCMsgStructure structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = ttType.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "GPS_WEEK_NUM")) { num++; } structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = wkNum.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "GPS_TIME")) { num++; } ulong num2 = TOW * ((ulong)0xf4240L); num2 &= (ulong)0xffffffffffL; structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = num2.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "DELTAT_UTC")) { num++; } uint num3 = 0x32c8; structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = num3.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "TIME_ACCURACY")) { num++; } byte num4 = utils_AutoReply.EncodeTimeAccuracy(acc, 0); structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = num4.ToString(); fieldList[num] = structure; str = utils_AutoReply.FieldList_to_HexString(true, fieldList, this.F_MSG_TYPE); } fieldList.Clear(); return(str); }
internal static ArrayList GetMessageStructure(string inputMsgFile, CommunicationManager.ReceiverType RxType, int mid, int sid, string protocol, string version) { XPathNavigator navigator = new XPathDocument(inputMsgFile).CreateNavigator(); int num = 2; int num2 = 2; int num3 = 0; if (RxType == CommunicationManager.ReceiverType.SLC) { num3 = 1; } ArrayList list = new ArrayList(); SLCMsgStructure structure = new SLCMsgStructure(); int num4 = 0; XPathExpression expr = navigator.Compile(string.Concat(new object[] { "/protocols/protocol[@name='", protocol, "'][@version='", version, "']/input/message[@mid='", mid, "'][@subid = '", sid, "']/field" })); XPathNodeIterator iterator = navigator.Select(expr); if (iterator.Count == 0) { expr = navigator.Compile(string.Concat(new object[] { "/protocols/protocol[@name='", protocol, "'][@version='", version, "']/input/message[@mid='", mid, "'][@subid = '']/field" })); iterator = navigator.Select(expr); } try { int num5 = 0; int num6 = 0; while (iterator.MoveNext()) { XPathNavigator navigator2 = iterator.Current.Clone(); if (navigator2.GetAttribute("name", "").Contains("LOOP")) { num5 = int.Parse(navigator2.GetAttribute("numloops", "")); num6 = int.Parse(navigator2.GetAttribute("numlines", "")); for (int i = 0; i < num5; i++) { for (int j = 0; j < num6; j++) { iterator.MoveNext(); navigator2 = iterator.Current.Clone(); structure.fieldNumber = iterator.CurrentPosition; structure.fieldName = navigator2.GetAttribute("name", ""); structure.bytes = int.Parse(navigator2.GetAttribute("bytes", "")); structure.datatype = navigator2.GetAttribute("datatype", ""); structure.units = navigator2.GetAttribute("units", ""); if (navigator2.GetAttribute("scale", "") == "") { structure.scale = 1.0; } else { structure.scale = double.Parse(navigator2.GetAttribute("scale", "")); } structure.startByte = (((num + num2) + num3) + 1) + num4; structure.endByte = (structure.startByte + structure.bytes) - 1; structure.defaultValue = navigator2.GetAttribute("default", ""); num4 += structure.bytes; list.Add(structure); } } } else { structure.fieldNumber = iterator.CurrentPosition; structure.fieldName = navigator2.GetAttribute("name", ""); structure.bytes = int.Parse(navigator2.GetAttribute("bytes", "")); structure.datatype = navigator2.GetAttribute("datatype", ""); structure.units = navigator2.GetAttribute("units", ""); if (navigator2.GetAttribute("scale", "") == "") { structure.scale = 1.0; } else { structure.scale = double.Parse(navigator2.GetAttribute("scale", "")); } structure.startByte = (((num + num2) + num3) + 1) + num4; structure.endByte = (structure.startByte + structure.bytes) - 1; structure.defaultValue = navigator2.GetAttribute("default", ""); num4 += structure.bytes; list.Add(structure); } } } catch (Exception exception) { throw exception; } return list; }
public ArrayList SLC_GetMessageStructure(int mid, int sid, string protocol, string version) { ArrayList list = new ArrayList(); SLCMsgStructure structure = new SLCMsgStructure(); int num = 0; XPathExpression expr = this.m_XPathNav.Compile(string.Concat(new object[] { "/protocols/protocol[@name='", protocol, "'][@version='", version, "']/message[@mid='", mid, "'][@subid = '']/field" })); XPathNodeIterator iterator = this.m_XPathNav.Select(expr); if (iterator.Count == 0) { expr = this.m_XPathNav.Compile(string.Concat(new object[] { "/protocols/protocol[@name='", protocol, "'][@version='", version, "']/message[@mid='", mid, "'][@subid = '", sid, "']/field" })); iterator = this.m_XPathNav.Select(expr); } try { while (iterator.MoveNext()) { XPathNavigator navigator = iterator.Current.Clone(); structure.fieldNumber = iterator.CurrentPosition; structure.fieldName = navigator.GetAttribute("name", ""); structure.bytes = int.Parse(navigator.GetAttribute("bytes", "")); structure.datatype = navigator.GetAttribute("datatype", ""); structure.units = navigator.GetAttribute("units", ""); if (navigator.GetAttribute("scale", "") == "") { structure.scale = 1.0; } else { structure.scale = double.Parse(navigator.GetAttribute("scale", "")); } structure.startByte = (((this.m_MsgHeaderSize + this.m_MsgPayloadSize) + this.m_MsgChannelSize) + 1) + num; structure.endByte = (structure.startByte + structure.bytes) - 1; structure.defaultValue = navigator.GetAttribute("default", ""); num += structure.bytes; list.Add(structure); } } catch (Exception exception) { throw exception; } return list; }
public string F_FreqTransResp_DataToHex(string F_ICD, int useFreqAiding, uint timeTag, int refClkInfo, double fAccuracy, short lastClkDrift, double fEclkScewppm, long nomFreq, bool includeNormFreq) { string str; ArrayList fieldList = new ArrayList(); if (useFreqAiding == 2) { str = this.F_Reject(F_ICD, this.F_ID_FREQ_TRANS, 4); } else { fieldList = utils_AutoReply.GetMessageStructure(base.ProtocolFile, CommunicationManager.ReceiverType.SLC, this.F_ID_FREQ_TRANS, 0, this.F_PROTOCOL_NAME, F_ICD); int num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "SCALED_FREQ_OFFSET")) { num++; } SLCMsgStructure structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = lastClkDrift.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "REL_FREQ_ACC")) { num++; } byte num2 = utils_AutoReply.get_REL_FREQ_ACC(fAccuracy); structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = num2.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "TIME_TAG")) { num++; } structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = timeTag.ToString(); fieldList[num] = structure; num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "REF_CLOCK_INFO")) { num++; } structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = ((byte)refClkInfo).ToString(); fieldList[num] = structure; double num4 = nomFreq * (1.0 + (fEclkScewppm * 1E-06)); ulong num3 = (ulong)(num4 * 1000.0); ulong num5 = num3 & ((ulong)0xffffffffffL); num = 0; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "NOMINAL_FREQ")) { num++; } structure = (SLCMsgStructure)fieldList[num]; structure.defaultValue = num5.ToString(); fieldList[num] = structure; if (!includeNormFreq) { fieldList.RemoveAt(fieldList.Count - 1); } str = utils_AutoReply.FieldList_to_HexString(true, fieldList, this.F_MSG_TYPE); } fieldList.Clear(); return(str); }
public string F_ApproxPos_DataToHex(string F_ICD, bool reject, double inLat, double inLon, double inAlt, double latSkew, double lonSkew, double estHorErr, double estVertErr) { string str; ArrayList fieldList = new ArrayList(); if (reject) { str = this.F_Reject(F_ICD, this.F_ID_APPROX_POS, 4); } else { Convert.ToDouble(F_ICD); fieldList = utils_AutoReply.GetMessageStructure(base.ProtocolFile, CommunicationManager.ReceiverType.SLC, this.F_ID_APPROX_POS, 0, this.F_PROTOCOL_NAME, F_ICD); int num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "LAT")) { num9++; } double num = inLat + latSkew; ulong num4 = (ulong)((num * 4294967296) / 180.0); SLCMsgStructure structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num4.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "LON")) { num9++; } double num2 = inLon + lonSkew; ulong num5 = (ulong)(((num2 * 4294967296) / 360.0) + 4294967296); structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num5.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "ALT")) { num9++; } double num3 = inAlt; ushort num6 = (ushort)((num3 + 500.0) / 0.1); structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num6.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "EST_HOR_ER")) { num9++; } byte num7 = utils_AutoReply.metersToICDHorzErr(estHorErr); structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num7.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "EST_VER_ER")) { num9++; } this.ref_verticalErr = Convert.ToDouble(((SLCMsgStructure)fieldList[num9]).defaultValue); ushort num8 = (ushort)(10.0 * estVertErr); structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num8.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "USE_ALT_AIDING")) { num9++; } structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = (num8 > 0) ? "1" : "0"; fieldList[num9] = structure; str = utils_AutoReply.FieldList_to_HexString(true, fieldList, this.F_MSG_TYPE); } fieldList.Clear(); return(str); }
public override string AutoSendPositionRequestMsg() { int num; ArrayList fieldList = new ArrayList(); fieldList = utils_AutoReply.GetMessageStructure(base._ai3ProtocolFile, CommunicationManager.ReceiverType.SLC, 1, 2, "AI3", "2.2"); if (fieldList.Count == 0) { return(string.Empty); } StringBuilder builder = new StringBuilder(); if (base._aidingProtocolVersion == "2.1") { builder.Append("33"); } else { builder.Append(((SLCMsgStructure)fieldList[0]).defaultValue); } for (num = 0; num < fieldList.Count; num++) { SLCMsgStructure structure = (SLCMsgStructure)fieldList[num]; switch (structure.fieldName) { case "NUM_FIXES": structure.defaultValue = base.PositionRequestCtrl.NumFixes.ToString(); break; case "TIME_BTW_FIXES": structure.defaultValue = base.PositionRequestCtrl.TimeBtwFixes.ToString(); break; case "HORI_ERROR_MAX": structure.defaultValue = base.PositionRequestCtrl.HorrErrMax.ToString(); break; case "VERT_ERROR_MAX": structure.defaultValue = base.PositionRequestCtrl.VertErrMax.ToString(); break; case "RESP_TIME_MAX": structure.defaultValue = base.PositionRequestCtrl.RespTimeMax.ToString(); break; case "TIME_ACC_PRIORITY": structure.defaultValue = base.PositionRequestCtrl.TimeAccPriority.ToString(); break; case "LOCATION_METHOD": structure.defaultValue = base.PositionRequestCtrl.LocMethod.ToString(); break; } fieldList[num] = structure; } string[] strArray = new string[800]; string ephDataMsg = base.EphDataMsg; for (int i = 0; i < 800; i++) { strArray[i] = "0"; } if ((base.AutoReplyParams.AutoAid_Eph_fromFile || base.AutoReplyParams.AutoAid_ExtEph_fromFile) && (ephDataMsg != "")) { strArray = ephDataMsg.Split(new char[] { ',' }); } num = 0; if (base._aidingProtocolVersion == "2.1") { while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "ICD_REV_NUM")) { num++; } SLCMsgStructure structure2 = (SLCMsgStructure)fieldList[num]; structure2.defaultValue = "33"; fieldList[num] = structure2; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "HORI_ERROR_MAX")) { num++; } SLCMsgStructure structure3 = (SLCMsgStructure)fieldList[num]; switch (structure3.defaultValue) { case "1": structure3.defaultValue = "0"; break; case "5": structure3.defaultValue = "1"; break; case "10": structure3.defaultValue = "2"; break; case "20": structure3.defaultValue = "3"; break; case "40": structure3.defaultValue = "4"; break; case "80": structure3.defaultValue = "5"; break; case "160": structure3.defaultValue = "6"; break; default: structure3.defaultValue = "7"; break; } fieldList[num] = structure3; } while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "1st EPH_FLAG")) { num++; } int num3 = num; for (int j = 0; num3 < (num + strArray.Length); j++) { SLCMsgStructure structure4 = (SLCMsgStructure)fieldList[num3]; structure4.defaultValue = strArray[j]; fieldList[num3] = structure4; num3++; } int num5 = 0x161; string[] strArray2 = new string[num5]; string[] strArray3 = new string[num5]; string acqAssistDataMsg = base.AcqAssistDataMsg; int num6 = 10; for (int k = 0; k < num5; k++) { strArray2[k] = "0"; } while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "ACQ_ASSIST_FLAG")) { num++; } if (acqAssistDataMsg != "") { SLCMsgStructure structure5 = (SLCMsgStructure)fieldList[num]; structure5.defaultValue = "1"; fieldList[num] = structure5; } else { SLCMsgStructure structure6 = (SLCMsgStructure)fieldList[num]; structure6.defaultValue = "0"; fieldList[num] = structure6; } if (base.AutoReplyParams.AutoAid_AcqData_fromFile) { strArray2 = acqAssistDataMsg.Split(new char[] { ',' }); int num8 = (strArray2.Length - 1) / num6; int num9 = 0; for (int num10 = 1; num9 < (num8 * 11); num10 += 10) { strArray3[num9++] = "1"; for (int num11 = 0; num11 < num6; num11++) { double num12 = Convert.ToDouble(strArray2[num11 + num10]); switch (num11) { case 2: if (num12 == 0.0) { strArray2[num11 + num10] = "-1.015265"; } break; case 3: if (num12 >= 200.0) { strArray2[num11 + num10] = "0"; } else if (num12 >= 100.0) { strArray2[num11 + num10] = "1"; } else if (num12 >= 50.0) { strArray2[num11 + num10] = "2"; } else if (num12 >= 25.0) { strArray2[num11 + num10] = "3"; } else if (num12 >= 12.5) { strArray2[num11 + num10] = "4"; } else if (num12 > 0.0) { strArray2[num11 + num10] = "0"; } else { strArray2[num11 + num10] = "255"; } break; default: if ((num11 == 4) && (num12 != 0.0)) { strArray2[num11 + num10] = ((int)(1023.0 - num12)).ToString(); } break; } strArray3[num9++] = strArray2[num11 + num10]; } } } while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "REFERENCE_TIME")) { num++; } SLCMsgStructure structure7 = (SLCMsgStructure)fieldList[num]; structure7.defaultValue = strArray2[0]; fieldList[num] = structure7; while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "1st ACQ_ASSIST_VALID_FLAG")) { num++; } int num14 = num; for (int m = 0; num14 < (num + strArray3.Length); m++) { SLCMsgStructure structure8 = (SLCMsgStructure)fieldList[num14]; structure8.defaultValue = strArray3[m]; fieldList[num14] = structure8; num14++; } while ((num < fieldList.Count) && (((SLCMsgStructure)fieldList[num]).fieldName != "NW_ENHANCE_TYPE")) { num++; } SLCMsgStructure structure9 = (SLCMsgStructure)fieldList[num]; structure9.defaultValue = base.HWCfgCtrl.NetworkEnhanceType.ToString(); fieldList[num] = structure9; for (int n = 1; n < fieldList.Count; n++) { if (string.IsNullOrEmpty(((SLCMsgStructure)fieldList[n]).defaultValue)) { builder.Append(","); builder.Append("0"); } else { builder.Append(","); builder.Append(((SLCMsgStructure)fieldList[n]).defaultValue); } } return(this.AI3_Request_ConvertFieldsToRaw(builder.ToString(), fieldList)); }
public override string GetAcqAssistMsgFromFile(string version, string acqAssistFilePath, double gpsTowNow) { int num = 10; string inputMsgFile = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\protocols\Protocols_F.xml"; ArrayList list = new ArrayList(); list = utils_AutoReply.GetMessageStructure(inputMsgFile, CommunicationManager.ReceiverType.OSP, 0xd3, 4, "OSP", version); ArrayList fieldList = new ArrayList(); string str2 = utils_AutoReply.getAcqAssistDataFromFile(acqAssistFilePath, gpsTowNow); if (str2 == "") { return(""); } string[] strArray = str2.Split(new char[] { ',' }); double num2 = Convert.ToDouble(strArray[0]); int num3 = 0; while ((num3 < list.Count) && (((SLCMsgStructure)list[num3]).fieldName != "REFERENCE_TIME")) { num3++; } SLCMsgStructure structure = (SLCMsgStructure)list[num3]; structure.defaultValue = num2.ToString(); list[num3] = structure; int num4 = (strArray.Length - 1) / num; num3 = 0; while ((num3 < list.Count) && (((SLCMsgStructure)list[num3]).fieldName != "NUM_SVS")) { num3++; } structure = (SLCMsgStructure)list[num3]; structure.defaultValue = num4.ToString(); list[num3] = structure; string[] strArray2 = new string[num4 * 11]; int num5 = 0; for (int i = 1; num5 < (num4 * 11); i += num) { strArray2[num5++] = "1"; for (int k = 0; k < num; k++) { double num8 = Convert.ToDouble(strArray[k + i]); switch (k) { case 2: if (num8 == 0.0) { strArray[k + i] = "-1.015265"; } break; case 3: if (num8 >= 200.0) { strArray[k + i] = "0"; } else if (num8 >= 100.0) { strArray[k + i] = "1"; } else if (num8 >= 50.0) { strArray[k + i] = "2"; } else if (num8 >= 25.0) { strArray[k + i] = "3"; } else if (num8 >= 12.5) { strArray[k + i] = "4"; } else if (num8 > 0.0) { strArray[k + i] = "0"; } else { strArray[k + i] = "255"; } break; default: if ((k == 4) && (num8 != 0.0)) { strArray[k + i] = ((int)(1023.0 - num8)).ToString(); } break; } strArray2[num5++] = strArray[k + i]; } } num3 = 0; while ((num3 < list.Count) && (((SLCMsgStructure)list[num3]).fieldName != "1st ACQ_ASSIST_VALID_FLAG")) { num3++; } int num10 = num3; for (int j = 0; num10 < (num3 + strArray2.Length); j++) { structure = (SLCMsgStructure)list[num10]; structure.defaultValue = strArray2[j]; list[num10] = structure; num10++; } for (num3 = 0; num3 < (strArray2.Length + 4); num3++) { fieldList.Add(list[num3]); } return(utils_AutoReply.FieldList_to_HexString(false, fieldList, 0)); }
public string OSPApproxPositionDataToHex(string osp_ICD, bool reject, double latitude, double longitude, double altitude, double distanceSkew, double headingSkew, double horr_Err, double vert_Err) { string str; ArrayList fieldList = new ArrayList(); if (reject) { str = this.OSPReject(osp_ICD, 0x49, 1, 4); } else { ulong num4; ulong num5; Convert.ToDouble(osp_ICD); List <double> list2 = utils_AutoReply.skewLatLon(latitude, longitude, distanceSkew, headingSkew); fieldList = utils_AutoReply.GetMessageStructure(base.ProtocolFile, CommunicationManager.ReceiverType.OSP, 0xd7, 1, "OSP", osp_ICD); int num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "LAT")) { num9++; } double num = list2[0]; if (num >= 0.0) { num4 = (ulong)((num * 4294967296) / 180.0); } else { num4 = (ulong)(((num * 4294967296) / 180.0) + 4294967296); } SLCMsgStructure structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num4.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "LON")) { num9++; } double num2 = list2[1]; if (num2 >= 0.0) { num5 = (ulong)((num2 * 4294967296) / 360.0); } else { num5 = (ulong)(((num2 * 4294967296) / 360.0) + 4294967296); } structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num5.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "ALT")) { num9++; } double num3 = altitude; ushort num6 = (ushort)((num3 + 500.0) / 0.1); structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num6.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "EST_HOR_ER")) { num9++; } byte num7 = utils_AutoReply.metersToICDHorzErr(horr_Err); structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num7.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "EST_VER_ER")) { num9++; } ushort num8 = (ushort)(10.0 * vert_Err); structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num8.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "USE_ALT_AIDING")) { num9++; } structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = (num8 > 0) ? "1" : "0"; fieldList[num9] = structure; str = utils_AutoReply.FieldList_to_HexString(false, fieldList, 0); } fieldList.Clear(); return(str); }
public string OSPApproxPositionDataToHex(string osp_ICD, bool reject, double latSkew, double lonSkew) { string str; ArrayList fieldList = new ArrayList(); if (reject) { str = this.OSPReject(osp_ICD, 0x49, 1, 4); } else { Convert.ToDouble(osp_ICD); fieldList = utils_AutoReply.GetMessageStructure(base.ProtocolFile, CommunicationManager.ReceiverType.OSP, 0xd7, 1, "OSP", osp_ICD); int num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "LAT")) { num9++; } this.ref_latitude = Convert.ToDouble(((SLCMsgStructure)fieldList[num9]).defaultValue); double num = this.ref_latitude + latSkew; ulong num4 = (ulong)((num * 4294967296) / 180.0); SLCMsgStructure structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num4.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "LON")) { num9++; } this.ref_longitude = Convert.ToDouble(((SLCMsgStructure)fieldList[num9]).defaultValue); double num2 = this.ref_longitude + lonSkew; ulong num5 = (ulong)(((num2 * 4294967296) / 360.0) + 4294967296); structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num5.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "ALT")) { num9++; } this.ref_altitude = Convert.ToDouble(((SLCMsgStructure)fieldList[num9]).defaultValue); ushort num6 = (ushort)((this.ref_altitude + 500.0) / 0.1); structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num6.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "EST_HOR_ER")) { num9++; } this.ref_horizontalErr = Convert.ToDouble(((SLCMsgStructure)fieldList[num9]).defaultValue); byte num7 = utils_AutoReply.metersToICDHorzErr(this.ref_horizontalErr); structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num7.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "EST_VER_ER")) { num9++; } this.ref_verticalErr = Convert.ToDouble(((SLCMsgStructure)fieldList[num9]).defaultValue); ushort num8 = (ushort)(10.0 * this.ref_verticalErr); structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = num8.ToString(); fieldList[num9] = structure; num9 = 0; while ((num9 < fieldList.Count) && (((SLCMsgStructure)fieldList[num9]).fieldName != "USE_ALT_AIDING")) { num9++; } structure = (SLCMsgStructure)fieldList[num9]; structure.defaultValue = (num8 > 0) ? "1" : "0"; fieldList[num9] = structure; str = utils_AutoReply.FieldList_to_HexString(false, fieldList, 0); } fieldList.Clear(); return(str); }