Exemplo n.º 1
0
        public void copySetElement(ClsCard clsCard)
        {
            int       max, idx;
            ClsGpsPos clsGpsPosDst;

            m_dLat      = clsCard.m_dLat;
            m_dLnd      = clsCard.m_dLnd;
            m_sSetNo    = clsCard.m_sSetNo;
            m_sIP       = clsCard.m_sIP;
            m_sSyoNo    = clsCard.m_sSyoNo;
            m_sSyoName  = clsCard.m_sSyoName;
            m_sAddress1 = clsCard.m_sAddress1;
            m_sAddress2 = clsCard.m_sAddress2;
            m_sTel1     = clsCard.m_sTel1;
            m_sTel2     = clsCard.m_sTel2;
            m_sName     = clsCard.m_sName;
            m_sBikou    = clsCard.m_sBikou;

            m_lstGpsPos.Clear();
            max = clsCard.m_lstGpsPos.Count;
            for (idx = 0; idx < max; idx++)
            {
                clsGpsPosDst = new ClsGpsPos();
                clsGpsPosDst.copySetElement(clsCard.m_lstGpsPos[idx]);
                m_lstGpsPos.Add(clsGpsPosDst);
            }
        }
Exemplo n.º 2
0
 public void copySetElement(ClsGpsPos clsGpsPos)
 {
     m_dLat  = clsGpsPos.m_dLat;
     m_dLnd  = clsGpsPos.m_dLnd;
     m_sDate = clsGpsPos.m_sDate;
 }
Exemplo n.º 3
0
        public void udpReceiveGPSData()
        {
            int       nIdx;
            int       max, i, j;
            string    sGpsPos;
            ClsGpsPos clsGpsPos;
            UdpClient udp;

            byte[] rcvBytes;
            string sSoutiNo;
            string sDate;

            if (m_sSelfIP == "")
            {
                return;
            }
            //UdpClientを作成し、ローカルエンドポイントにバインドする
            udp            = new UdpClient(m_nPort);
            m_rcvUDPClient = udp;
            IPEndPoint remoteEP = null;

            try
            {
                rcvBytes = udp.Receive(ref remoteEP);
            }
            catch (Exception ex)
            {
                udp.Close();
                return;
            }
            if (rcvBytes[0] == 'e' &&
                rcvBytes[1] == 'x' &&
                rcvBytes[2] == 'i' &&
                rcvBytes[3] == 't')
            {
                m_bUDPFlag = false;
                return;
            }
            m_bUDPFlag = false;
            max        = rcvBytes.Length - 5;
            byte[] strBytes = new byte[max];
            byte[] skey     = System.Text.Encoding.UTF8.GetBytes("{{[[");
            byte[] ekey     = System.Text.Encoding.UTF8.GetBytes("]]}}");
            for (i = 0; i < max; i++)
            {
                if ((skey[0] == rcvBytes[i]) &&
                    (skey[1] == rcvBytes[i + 1]) &&
                    (skey[2] == rcvBytes[i + 2]) &&
                    (skey[3] == rcvBytes[i + 3]))
                {
                    break;
                }
            }
            if (i == max)
            {
                udp.Close();
                return;
            }
            for (i = i + 4, j = 0; i < max; i++, j++)
            {
                if ((ekey[0] == rcvBytes[i]) &&
                    (ekey[1] == rcvBytes[i + 1]) &&
                    (ekey[2] == rcvBytes[i + 2]) &&
                    (ekey[3] == rcvBytes[i + 3]))
                {
                    break;
                }
                strBytes[j] = rcvBytes[i];
            }
            for (; j < max; j++)
            {
                strBytes[j] = 0;
            }
            sGpsPos = Encoding.UTF8.GetString(strBytes);
            string[] ary = sGpsPos.Split(',');
            //受信した送信者の情報
            // remoteEP.Address, remoteEP.Port;
            // if (m_clsCardCrt.checkIP(remoteEP.Address) == true)
            //if (checkRemoteIP(remoteEP.Address) == true)
            //{
            clsGpsPos = new ClsGpsPos();
            sSoutiNo  = m_libCmn.DeleteDoubleQuotation(ary[0]);
            nIdx      = searchCardIdx(sSoutiNo);
            if (nIdx != -1)
            {
                sDate             = m_libCmn.DeleteDoubleQuotation(ary[1]);
                clsGpsPos.m_sDate = sDate;
                clsGpsPos.m_dLat  = m_libCmn.StrToDouble(ary[2]);
                clsGpsPos.m_dLnd  = m_libCmn.StrToDouble(ary[3]);
                m_clsObserve.m_lstClsCard[nIdx].m_lstGpsPos.Add(clsGpsPos);
            }
            //}
            //UdpClientを閉じる
            udp.Close();
        }