中兴NMEA GSM模块问题 [英] ZTE NMEA GSM module issue

查看:50
本文介绍了中兴NMEA GSM模块问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我目前正在开发一个用于发送短信的应用程序,但是当我尝试打开gsm模块附加的端口时,它总是说请求的资源正在使用,因此我无法打开使用的端口。我发现当GSM模块的软件运行时会发生这种情况,我尝试关闭它,但GSM调制解调器丢失其信号并变为红色状态。同样在设备管理器中,它显示GSM调制解调器的两个端口,一个用于中兴NMEA,另一个用于中兴诊断服务。

我无法使用中兴通讯NMEA的端口,因为它似乎是当前使用的端口,并尝试了其他端口,但通过vb发送消息没有成功。但是,我可以直接通过GSM模块发送消息。有没有解决方法呢?提前谢谢。



这是我的代码:



Hi all,, I am currently developing an app in vb to send sms, however when i try to open the port in which the gsm module is attach it always says "the requested resource is in use" thus I cannot open the port to used. I found it that this occurs when the software of the GSM module is running, I tried closing it but the GSM modem loses its signal and becomes red status. Also in Device Manager it shows two ports for the GSM modem, one is for ZTE NMEA and the other is ZTE Diagnostics Services.
Im unable to use the port for the ZTE NMEA since it seems its currently the one in used,, and tried the other port but no success in sending a message thru vb. However, I can send a message thru the GSM module directly. Is there any workaround on this. thanks in advance.

here is my code:

Private Sub btnConnect_Click(sender As Object, e As EventArgs) Handles btnConnect.Click
        If SerialPort2.IsOpen = True Then
            SerialPort2.Close()
            btnConnect.Text = "Connect"
        Else
            Try
                With SerialPort2
                    '.PortName = Trim(Mid(ComboBox1.Text, 1, 5))
                    .BaudRate = 9600
                    .Parity = IO.Ports.Parity.None
                    .DataBits = 8
                    .StopBits = StopBits.One
                    .Handshake = Handshake.None
                    .RtsEnable = True
                    .DtrEnable = True
                    .Open()
                    .WriteLine("AT+CNMI=1,2,0,0,0" & vbCrLf) 'send whatever data that it receives to serial port  
                End With
                MsgBox("Connected")
                btnConnect.Text = "Disconnect"
            Catch ex As Exception
                btnConnect.Text = "Connect"
                MsgBox(ex.Message)
            End Try
        End If
    End Sub

    Private Sub btnSend_Click(sender As Object, e As EventArgs) Handles btnSend.Click
        Try
            With SerialPort2
                .WriteLine("AT" & vbCrLf)
                Threading.Thread.Sleep(1000)
                .WriteLine("AT+CMGF=1" & vbCrLf) 'Instruct the GSM / GPRS modem to operate in SMS text mode
                Threading.Thread.Sleep(1000)
                .WriteLine("AT+CMGS=" & Chr(34) & txtnum.Text & Chr(34) & vbCr) '
                Threading.Thread.Sleep(1000) '
                .WriteLine(txtmssge.Text & Chr(26)) '

            End With

            MsgBox("Message Sent")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub





我尝试了什么:



我尝试使用谷歌搜索解决方案,但他们只显示通过vb发送短信的代码。我尝试使用两个端口,但没有运气。奇怪的是我无法关闭端口并重新打开使用,或GSM模块不能用于此应用程序..



What I have tried:

I have tried googling for the solution but they only show codes for sending the SMS thru vb. I tried using both the ports but no luck at all. Its just weird that i cannot close the port and reopen it for used, or does the GSM module cannot be used for this app..

推荐答案

串口是独占的。虽然应用程序打开了一个串口,但是它不能被另一个(甚至是同一个)应用程序打开。



您想到的解决方案问题是执行与GSM模块软件相同的任务来初始化调制解调器。然后您不再需要该软件并且可以发送您的短信。



关于诊断端口,您应该查阅调制解调器手册。但它不太可能用于发送短信。这些端口通常只提供状态信息。
Serial ports are exclusive. While a serial port is opened by an application, it can't be opened anymore by another (or even the same) application.

The solution coming into mind for your problem is performing the same tasks as the GSM module software to initialise the modem. Then you don't need that software anymore and can send your SMS.

Regarding the diagnostics port you should consult the modem manual. But it is rather improbable that it can be used to send SMS. Such ports are usually providing only status information.


这篇关于中兴NMEA GSM模块问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆