Exemplo n.º 1
0
        public MURUData()
        {
            int i = 0;

            for (i = 0; i < 4; i++)
            {
                afGain[i] = new AFGain();
            }

            for (i = 0; i < 5; i++)
            {
                ruData[i] = new RUData();
            }
        }
Exemplo n.º 2
0
        void sUser_Received(SendReceive SendRecv, byte[] buffer, int lng)
        {
            #region 수신된 Data 기본처리
            //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            int i = 0, j = 0;

            int  chkSum = 0, iLow, iHigh;
            byte bL = 0x00, bH = 0x00;

            if (clsCommon.flagDebug[clsCommon.NMS])
            {
                string strData = null;

                if (fMain.flagDataViewTypeASCII)
                {
                    strData = Encoding.Default.GetString(buffer, 0, lng);
                }
                else
                {
                    for (i = 0; i < lng; i++)
                    {
                        strData += string.Format(" {0:X2}", buffer[i]);
                    }
                }

                this.nms_SendReceiveDataView(false, strData);
            }

            for (i = 0; i < lng - 2; i++)
            {
                chkSum = chkSum ^ buffer[i];
            }

            iLow  = chkSum & 0x0F;
            iHigh = chkSum >> 4;
            bH    = clsCommon.HexaConvert(iHigh);
            bL    = clsCommon.HexaConvert(iLow);

            this.nms_DataSendReceive(false);

            if ((bH != buffer[lng - 2]) || (bL != buffer[lng - 1]))
            {
                return;
            }
            //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            #endregion

            j = 2;
            byte tmpMUId = buffer[j++];     //MU ID
            byte tmpRUId = buffer[j++];     //RU ID
            byte tmpCMD  = buffer[j++];     //CMD
            int  tmpLng  = buffer[j++];     //Data 길이

            byte tmpBdaId = 0;

            tmpMUId = (byte)(tmpMUId - 0x40);
            tmpRUId = (byte)(tmpRUId - 0x30);

            switch (tmpCMD)
            {
            case CMD_MsinStbyChange:                         //0x43 - C : 주/예비 절체
                byte mainSpare = clsCommon.AHD(buffer[j++]); //주/예비
                this.nms_MainSpareChange(tmpMUId, tmpRUId, mainSpare);
                break;

            case CMD_AutoManualChange:
                byte autoManual = clsCommon.AHD(buffer[j++]);      //Auto/Manual
                this.nms_AutoStbyChange(tmpMUId, tmpRUId, autoManual);
                break;

            case CMD_RFGainSet:                                //F : RF 출력 조절
                byte mainStby    = clsCommon.AHD(buffer[j++]); //주/예비
                byte rfGainValue = buffer[j++];                //RF 출력값

                this.nms_RfGainSet(tmpMUId, tmpRUId, mainStby, rfGainValue);
                break;

            case CMD_AFGainSet_CCE:        //E : CCE/RC1/RC2/RC3 TX/RX/MOB AF Gain값 설정
            case CMD_AFGainSet_RC1:        //1
            case CMD_AFGainSet_RC2:        //2
            case CMD_AFGainSet_RC3:        //3
                AFGain tmpAfGain = new AFGain();

                tmpAfGain.gainTx  = buffer[j++];
                tmpAfGain.gainRx  = buffer[j++];
                tmpAfGain.gainMon = buffer[j++];

                if (tmpAfGain.gainTx >= 0x80)
                {
                    tmpAfGain.gainTx = (tmpAfGain.gainTx - 0x80) * -1;
                }
                if (tmpAfGain.gainRx >= 0x80)
                {
                    tmpAfGain.gainRx = (tmpAfGain.gainRx - 0x80) * -1;
                }
                if (tmpAfGain.gainMon >= 0x80)
                {
                    tmpAfGain.gainMon = (tmpAfGain.gainMon - 0x80) * -1;
                }

                this.nms_AfGainSet(tmpMUId, tmpRUId, tmpCMD, tmpAfGain);
                break;

            case CMD_AFGain:        //Q : CCE, RC1, RC2, RC3의 TX/RX/MON AF Gain값 요청
                this.nms_AfGainInquiry(tmpMUId, tmpRUId);
                break;

            case CMD_WideNarrowChange:          //B : 무전기 형식 절체
                byte wideNarrow = clsCommon.AHD(buffer[j++]);
                this.nms_WideNarrowChange(tmpMUId, tmpRUId, wideNarrow);
                break;

            case CMD_ChReturnTimeSet:       //H : 채널복귀시간 설정
                byte chReturnTime = buffer[j++];
                this.nms_ChReturnTimeSet(tmpMUId, chReturnTime);
                break;

            case CMD_BDA_Init:          //BDA 초기값 설정
                BDAInit tmpBdaInitSt = new BDAInit();

                for (i = 0; i < 4; i++)
                {
                    if (buffer[j++] == 1)
                    {
                        tmpBdaInitSt.flagBDAEnable[i] = true;
                    }
                }

                j++;        //주파수 설정 사용안함

                if (buffer[j++] == 1)
                {
                    tmpBdaInitSt.flagBDAPollEnable = true;
                }

                tmpBdaInitSt.pollTime = buffer[j++];

                this.nms_BdaInitStSet(tmpMUId, tmpRUId, tmpBdaInitSt);
                break;

            case CMD_BDA_Set:           //BDA 설정값 요청
                this.nms_BdaInitStInquiry(tmpMUId, tmpRUId);
                break;

            case CMD_BDA_StReport:      //BDA 상태 요청
                tmpBdaId = buffer[j++]; //BDA ID
                this.nms_BdaStInquiry(tmpMUId, tmpRUId, tmpBdaId);
                break;

            case CMD_BDA_LoopTest:      //BDA LoopTest 요청
                tmpBdaId = buffer[j++]; //BDA ID
                this.nms_BdaLoopTest(tmpMUId, tmpRUId, tmpBdaId);
                break;

            case CMD_BDA_Rf:            //BDA RF 출력값 요청
                tmpBdaId = buffer[j++]; //BDA ID
                this.nms_BdaRfInquiry(tmpMUId, tmpRUId, tmpBdaId);
                break;

            case CMD_BDA_RfSet:                //BDA RF 출력값 설정
                tmpBdaId = buffer[j++];        //BDA ID
                byte tmpRfValue = buffer[j++]; //Rf 출력값
                this.nms_BdaRfSet(tmpMUId, tmpRUId, tmpBdaId, tmpRfValue);
                break;

            case CMD_BDA_FreqSet:       //BDA 주파수 설정
                byte[] tmpFreq = new byte[2];

                tmpFreq[0] = buffer[j++];
                tmpFreq[1] = buffer[j++];

                this.nms_BdaFreqSet(tmpMUId, tmpRUId, tmpFreq);
                break;

            case CMD_POLLING:
                cntPolling = 0;
                break;
            }
        }