Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows mobile 接收在Windows Mobile 6.5 HSDPA设备上不工作的USSD消息(Opennetcf.Telephony)_Windows Mobile_Ussd - Fatal编程技术网

Windows mobile 接收在Windows Mobile 6.5 HSDPA设备上不工作的USSD消息(Opennetcf.Telephony)

Windows mobile 接收在Windows Mobile 6.5 HSDPA设备上不工作的USSD消息(Opennetcf.Telephony),windows-mobile,ussd,Windows Mobile,Ussd,我一直在使用OpenNetCF.Telephony(可在此处获得),使用这个包装器可以非常容易地使用TAPI发送和接收USSD消息;直到现在,我一直在使用它与许多GSM设备,它的工作完美 最近,我在Motorola MC65和ES400上测试了我的程序,这两种设备都是3.5G HSDPA设备,能够毫无问题地发送我的USSD请求,但读取消息功能没有捕获到响应;奇怪的是,它与我使用过的所有其他GSM设备中的代码完全相同,因为USSD在响应时会显示一个弹出窗口,我知道运营商的服务器响应非常快,但我的L

我一直在使用OpenNetCF.Telephony(可在此处获得),使用这个包装器可以非常容易地使用TAPI发送和接收USSD消息;直到现在,我一直在使用它与许多GSM设备,它的工作完美

最近,我在Motorola MC65和ES400上测试了我的程序,这两种设备都是3.5G HSDPA设备,能够毫无问题地发送我的USSD请求,但读取消息功能没有捕获到响应;奇怪的是,它与我使用过的所有其他GSM设备中的代码完全相同,因为USSD在响应时会显示一个弹出窗口,我知道运营商的服务器响应非常快,但我的LineGetMessage呼叫在没有注意到收到响应的情况下超时

这是我为测试功能而做的一个小样本的摘录,它可以在任何地方进行测试,因为任何运营商的平台都会响应“未知应用程序”或类似的消息,如果它不希望发送消息,但即使是这个响应也不会被捕获

        private void btnUSSDSend_Click(object sender, EventArgs e)
    {
        int ret = 0; 
        for (int i = 0; i < m_tapi.NumberOfDevices; i++)
        {

            DeviceCapabilities dc = new DeviceCapabilities(LINE_DEV_CAPS_INITIAL_SIZE); //LINEDEVCAPS
            dc.Store(); 
            int dwVersion = m_tapi.NegotiateVersion(i);
            ret = NativeMethods.lineGetDevCaps(m_tapi.hLineApp, i, dwVersion, 0, dc.Data); //NativeTapi.lineGetDevCaps
            if (ret < 0)
            {
                MessageBox.Show(((ErrorCode)ret).ToString()); //LINEERR
            }

            if ((ErrorCode)ret == ErrorCode.StructureTooSmall)  //LINEERR  STRUCTURETOOSMALL
            {
                dc.Data = new byte[dc.NeededSize]; //dc.dwNeededSize
                ret = NativeMethods.lineGetDevCaps(m_tapi.hLineApp, i, dwVersion, 0, dc.Data); //NativeTapi
            }

            dc.Load();

            DeviceCaps.Add( i, dc);

            AddressStatus ac = new AddressStatus(1024);
            ac.Store();
            ret = NativeMethods.lineGetAddressCaps(m_tapi.hLineApp, i, 0, dwVersion, 0, ac.Data); //NativeTapi
            ac.Load();
            ac = null;

        }


        bool found = false;
        foreach (KeyValuePair<int, DeviceCapabilities> entry in DeviceCaps) //LINEDEVCAPS
        {
            DeviceCapabilities dc = entry.Value;  //LINEDEVCAPS 
            found = true;
            if (dc != null && dc.ProviderName.StartsWith(NativeMethods.CELLTSP_PROVIDERINFO_STRING)) //CellTSP.CELLTSP_PROVIDERINFO_STRING
            {
                m_line = m_tapi.CreateLine(entry.Key,  MediaMode.DataModem  | MediaMode.InteractiveVoice, CallPrivilege.Monitor |CallPrivilege.Owner ); //LINEMEDIAMODE LINECALLPRIVILEGE

                byte[] dialArray; 
                LineMessage msg; //LINEMESSAGE
                int flags = 0;
                byte[] chResponse;
                string Mensaje="";
                string dial = "*888#";
                int continuetonext = 0;
            needtosendanother:
                dialArray= Encoding.Unicode.GetBytes(dial);
                int length = dialArray.Length;
                int result = NativeMethods.lineSendUSSD(m_line.hLine, dialArray, dialArray.Length, 0); 
                AddMessage(dial, 0);


                while ( NativeMethods.lineGetMessage(m_tapi.hLineApp, out msg,10000)==0 ) //NativeTapi
                { 
                    if (msg.MessageID == LineMessages.LINE_DEVSPECIFIC && (int)(msg.Param1) == (int)LineMessages.LINE_USSD) //msg.dwMessageID | LINEMESSAGES | LINEDEVSPECIFIC_CELLTSP
                    {
                        flags = 0;
                        chResponse = new byte[(int)(msg.Param3)]; //msg.dwParam3
                        result = NativeMethods.lineGetUSSD(m_line.hLine, (int)(msg.Param2), chResponse, chResponse.Length, out flags); 
                        Mensaje = Encoding.Unicode.GetString(chResponse, 0, chResponse.Length);
                        AddMessage(Mensaje, 1);
                        break;
                    }
                }
                //in case I have to respond to another message
                if (Mensaje.ToUpper().Contains("ENTER PIN:"))
                {
                    continuetonext = 1;
                    dial = "1234";
                }
                //some more conditions here...
                //
                if (Mensaje.ToUpper().Contains("TRANSFERED"))
                {
                    continuetonext = 0;
                    dial = "TRANSFERED";
                }
                if (Mensaje.ToUpper().Contains("FAILED") || Mensaje.ToUpper().Contains("ERROR"))
                {
                    continuetonext = 0;
                    dial = "ERROR";
                }
                if (continuetonext==1) goto needtosendanother;
            }

        }

        if (!found)
        {
            MessageBox.Show("Error - line not found");
            return;
        }
    }
private void btnUSSDSend\u单击(对象发送方,事件参数e)
{
int-ret=0;
对于(int i=0;i
这是没有得到响应的代码,它每次都会超时:(

while(NativeMethods.lineGetMessage(m_tapi.hLineApp,out msg,10000)=0)

我知道我已经正确初始化了TAPI,因为我已经发送了参数来注册事件,实际上它通过发送USSD请求来接收确认行消息,该请求由TAPI包装中实例化的另一个线程处理,但是在这些设备中从未引发实际响应的事件

为了让3/3.5G设备正常工作,是否需要做一些改变?我一直在比较2G设备的所有功能(与代码),所有功能似乎都完全相同,只是读取响应是问题所在,我真的不知道如何让它正常工作

提前感谢您提出的任何其他想法或更改参数。。。