// On Device Msg private void OnDeviceMsg(IntPtr wParam, IntPtr Lparam) { int nMsg = new int(); int nLine = new int(); nMsg = wParam.ToInt32() % 65536; nLine = wParam.ToInt32() / 65536; switch (nMsg) { case MCU_BACKDISABLE: break; case MCU_BACKENABLE: break; case MCU_BACKID: { StringBuilder szCPUVersion = new StringBuilder(32); AD101_GetCPUVersion(nLine, szCPUVersion); } break; case MCU_BACKCID: { StringBuilder szCallerID = new StringBuilder(128); StringBuilder szName = new StringBuilder(128); StringBuilder szTime = new StringBuilder(128); int nLen = AD101_GetCallerID(nLine, szCallerID, szName, szTime); txtPhone.Text = szCallerID.ToString(); funGetCustomerData(); this.BringToFront(); this.TopMost = true; this.WindowState = FormWindowState.Normal; ActiveControl = btnReceive; } break; case MCU_BACKSTATE: { switch (Lparam.ToInt32()) { case HKONSTATEPRA: break; case HKONSTATEPRB: break; case HKONSTATENOPR: break; case HKOFFSTATEPRA: { } break; case HKOFFSTATEPRB: { } break; case NO_LINE: { } break; case RINGONSTATE: { StringBuilder szCallerID = new StringBuilder(128); StringBuilder szName = new StringBuilder(128); StringBuilder szTime = new StringBuilder(128); int nLen = AD101_GetCallerID(nLine, szCallerID, szName, szTime); txtPhone.Text = szCallerID.ToString(); funGetCustomerData(); this.BringToFront(); this.TopMost = true; this.WindowState = FormWindowState.Normal; ActiveControl = btnReceive; //string szRing = "Ring:" + string.Format("{0:D2}", AD101_GetRingIndex(nLine)); ////label1.Text = szRing; //if (AD101_GetRingIndex(nLine) >= 0 && AD101_GetRingIndex(nLine) <= 3) //{ // tmr_customerphone.Start(); //} //else if (AD101_GetRingIndex(nLine) > 3) //{ // tmr_customerphone.Stop(); // player.Stop(); //} } break; case RINGOFFSTATE: break; case NOHKPRA: break; case NOHKPRB: break; case NOHKNOPR: { } break; default: break; } } break; case MCU_BACKDIGIT: { } break; case MCU_BACKCOLLATERAL: { StringBuilder szDialDigit = new StringBuilder(128); AD101_GetCollateralDialDigit(nLine, szDialDigit); } break; case MCU_BACKDEVICE: { StringBuilder szCPUVersion = new StringBuilder(32); AD101_GetCPUVersion(nLine, szCPUVersion); } break; case MCU_BACKPARAM: { AD101DEVICEPARAMETER tagParameter = new AD101DEVICEPARAMETER(); AD101_GetParameter(nLine, ref tagParameter); } break; case MCU_BACKCPUID: { StringBuilder szCPUID = new StringBuilder(4); AD101_GetCPUID(nLine, szCPUID); } break; case MCU_BACKMISSED: { } break; case MCU_BACKTALK: { string strTalk; strTalk = string.Format("{0:D2}", Lparam) + "S"; } break; default: break; } }
public static extern int AD101_SetParameter(int nLine, ref AD101DEVICEPARAMETER tagParameter);