C ++ all at命令用于SMS返回的ERROR [英] C++ all at command's for SMS return's ERROR

查看:150
本文介绍了C ++ all at命令用于SMS返回的ERROR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!



我正在用C ++创建Windows应用程序,它通过蓝牙和winsock连接PC和移动设备。允许你通过计算机从手机拨打和发送信息。



我正在使用AT命令告诉移动我想做什么。与移动设备配对并使用At命令强制拨打电话

Hi there!

I'm creating windows application in C++, which connect's PC with mobile via bluetooth and winsock. Allow's you to call and send messages from mobile via computer.

I'm using AT command's to tell mobile what i want to do. Pair with mobile device and force a call with At command

ATD+420******;

工作正常,但所有处理短信的命令如

works perfect, but all commands for handling SMS like

AT+CMGL, AT+CMGF, AT+CMGS etc.

返回错误。



这是通过蓝牙连接PC和移动设备的代码socket:

return's ERROR.

Here is code which connects PC with mobile via bluetooth and socket:

SOCKADDR_BTH RemoteEndPoint;
	RemoteEndPoint.port = 0;
	RemoteEndPoint.addressFamily = AF_BTH;
	RemoteEndPoint.btAddr = m_foundDevices[m_deviceIndex].Address.ullLong;
	RemoteEndPoint.serviceClassId = HandsfreeServiceClass_UUID;
	int BTHAddrLength = sizeof(RemoteEndPoint);

	// Create the socket.
	if ((m_localSocket = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM)) == INVALID_SOCKET)
	{
		// handle error.
	}

	// Connect the socket.
	if ((iResult = connect(m_localSocket, (SOCKADDR *)&RemoteEndPoint, sizeof(RemoteEndPoint))) == INVALID_SOCKET)
	{
		// handle error.
	}



通知行


Notice line

RemoteEndPoint.serviceClassId = HandsfreeServiceClass_UUID



我认为问题出在这里,因为你不能从免提发送短信,但当我使用另一个UUID时,它甚至不与移动配对。



===这里只是为了info,我如何从手机发送和接收数据===


I think the problem is here, becouse u cant send sms from Handsfree, but when i use another UUID, it doesnt even pair with mobile.

=== Here is just for info, how am i sending and receiving data from mobile ===

char recvbuf[DEFAULT_BUFLEN] = "";
const char *sendbuf = "AT+CMGL\r";
int len = (int)strlen(sendbuf);
if ((iResult = send(m_localSocket, sendbuf, len, MSG_OOB)) == SOCKET_ERROR)
	{
		// handle error. return ~0
	}

	if ((iResult = recv(m_localSocket, recvbuf, recvbuflen, 0)) == SOCKET_ERROR)
	{
		// handle error. return ~0
	}
// Here recvbuf == "\r\nERROR\r\n"



谢谢你任何建议!如果你有任何关于问题的问题,我会好好解释一下。

问候,

菲利普。



我尝试过:



使用其他手机和其他操作系统。 < - 没有用。

使用另一个UUID< - 没有工作。



谷歌搜索了很多小时,没有找不到任何解决方案。


Thank you for any advices! If you have any question's about problem, i'll kindly explain.
Regards,
Filip.

What I have tried:

Use another phones, with other OS. <- Didn't work.
Use another UUID's <- Didn't work.

Googling a lot of hour's, didn't find any solution.

推荐答案

将调制解调器命令发送到蓝牙设备听起来有点紧张。



我认为你使用的是坏命令,所以请阅读文章使用AT命令通过GSM调制解调器发送和读取SMS 以了解有关此问题的更多信息。
Sending modem commands to a bluetooth device sounds a bit weired.

I think you are using bad commands, so read the article Send and Read SMS through a GSM Modem using AT Commands to learn more about this issue.


这篇关于C ++ all at命令用于SMS返回的ERROR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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