private int APRSParse(string sString, ref APRSPOSITION aprsPosition, ref APRSSTATUS aprsStatus) { int iRet = -1; try { lock ("ExternDllAccess") { //Call the APRS DLL iRet = APRSParseLinePosStat(sString, ref aprsPosition, ref aprsStatus); } } catch (Exception) { iRet = -1; } return(iRet); }
public bool Parse(string sMsg, int iIndex) { bool bRet = false; //Init APRS structures APRSPOSITION aprsPosition = new APRSPOSITION(); APRSSTATUS aprsStatus = new APRSSTATUS(); aprsPosition.source = new string(' ', 10); aprsPosition.sentence = new string(' ', 6); aprsPosition.name = new string(' ', 10); aprsStatus.source = new string(' ', 10); aprsStatus.comment = new string(' ', 256); if (APRSParse(sMsg, ref aprsPosition, ref aprsStatus) >= 0) { bRet = false; GPSSource gpsSource = (GPSSource)m_GpsTracker.m_gpsSourceList[iIndex]; for (int i = 0; i < gpsSource.sCallSignFilterLines.Length - 1; i++) { string source = aprsPosition.source; string sourceFilter = gpsSource.sCallSignFilterLines[i]; int iWildIndex = sourceFilter.LastIndexOf('*'); if (iWildIndex == 0) { bRet = true; break; } else if (iWildIndex >= 1) { sourceFilter = sourceFilter.Substring(0, iWildIndex); if (source.ToUpper().StartsWith(sourceFilter.ToUpper())) { bRet = true; break; } } else if (iWildIndex == -1 && source.ToUpper() == sourceFilter.ToUpper()) { bRet = true; break; } } if (gpsSource.sCallSignFilterLines.Length <= 1) { bRet = true; } if (bRet) { gpsSource.GpsPos.m_fLat = Convert.ToSingle(aprsPosition.latitude); gpsSource.GpsPos.m_fLon = Convert.ToSingle(aprsPosition.longitude); gpsSource.GpsPos.m_fAlt = aprsPosition.altitude; gpsSource.GpsPos.m_fSpeed = aprsPosition.speed_over_ground; gpsSource.GpsPos.m_sName = aprsPosition.source; gpsSource.GpsPos.m_sComment = aprsStatus.comment; gpsSource.GpsPos.m_iAPRSIconCode = Convert.ToInt32(aprsStatus.symbol_code); gpsSource.GpsPos.m_iAPRSIconTable = Convert.ToInt32(aprsStatus.symbol_table); } } return(bRet); }
private static extern int APRSParseLinePosStat(string sString, ref APRSPOSITION aprsPosition, ref APRSSTATUS aprsStatus);
public bool Parse(string sMsg, int iIndex) { bool bRet=false; //Init APRS structures APRSPOSITION aprsPosition = new APRSPOSITION(); APRSSTATUS aprsStatus = new APRSSTATUS(); aprsPosition.source = new string(' ',10); aprsPosition.sentence = new string(' ',6); aprsPosition.name = new string(' ', 10); aprsStatus.source = new string(' ',10); aprsStatus.comment = new string(' ',256); if (APRSParse(sMsg , ref aprsPosition, ref aprsStatus)>=0) { bRet=false; GPSSource gpsSource=(GPSSource)m_GpsTracker.m_gpsSourceList[iIndex]; for (int i=0; i<gpsSource.sCallSignFilterLines.Length-1; i++) { string source=aprsPosition.source; string sourceFilter=gpsSource.sCallSignFilterLines[i]; int iWildIndex=sourceFilter.LastIndexOf('*'); if (iWildIndex==0) { bRet=true; break; } else if (iWildIndex>=1) { sourceFilter=sourceFilter.Substring(0,iWildIndex); if (source.ToUpper().StartsWith(sourceFilter.ToUpper())) { bRet=true; break; } } else if (iWildIndex==-1 && source.ToUpper()==sourceFilter.ToUpper()) { bRet=true; break; } } if (gpsSource.sCallSignFilterLines.Length<=1) bRet=true; if (bRet) { gpsSource.GpsPos.m_fLat = Convert.ToSingle(aprsPosition.latitude); gpsSource.GpsPos.m_fLon = Convert.ToSingle(aprsPosition.longitude); gpsSource.GpsPos.m_fAlt = aprsPosition.altitude; gpsSource.GpsPos.m_fSpeed = aprsPosition.speed_over_ground; gpsSource.GpsPos.m_sName = aprsPosition.source; gpsSource.GpsPos.m_sComment = aprsStatus.comment; gpsSource.GpsPos.m_iAPRSIconCode = Convert.ToInt32(aprsStatus.symbol_code); gpsSource.GpsPos.m_iAPRSIconTable = Convert.ToInt32(aprsStatus.symbol_table); } } return bRet; }
private int APRSParse(string sString, ref APRSPOSITION aprsPosition, ref APRSSTATUS aprsStatus) { int iRet=-1; try { lock("ExternDllAccess") { //Call the APRS DLL iRet=APRSParseLinePosStat(sString , ref aprsPosition, ref aprsStatus); } } catch(Exception) { iRet=-1; } return iRet; }