我们公司和移远有合作所以得到了他们EC20的二次开发的开发板。下面是我开发4G图像传输的总结(工作方式有两种,一种AT一种socket)。
下面先是AT命令
一.在linux下解压文件
解压如下文件
二.安装SDK
每次开新的终端进行编译都要进行环境变量的设置
三.进入历程
四.修改历程
#include "ql_oe.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
//those define was added by myself
#define MAXLINE 1024 //一次读取最大的字节数
#define QUEC_AT_PORT "/dev/smd8"
static int smd_fd = -1;
int Ql_SendAT(char* atCmd, char* finalRsp, long timeout_ms, int should_Add);
int main(int argc, char* argv[])
{
FILE *from_file; //need send to server
char buf[MAXLINE];
char receive_buf[100];
int read_len;
char str[10];
printf("< Quectel OpenLinux: AT example >\n");
smd_fd = open(QUEC_AT_PORT, O_RDWR | O_NONBLOCK | O_NOCTTY); //打开虚拟串口
printf("< open(\"%s\")=%d >\n", QUEC_AT_PORT, smd_fd);
Ql_SendAT("AT+COPS?", "OK", 1000, 0); //检查网络
if((from_file=open("timg.jpg",O_RDWR))==NULL) //打开要读取的文件
{
printf("Can't open the file \n");
exit(1);
}
Ql_SendAT("AT+QIOPEN=1,2,\"UDP SERVICE\",\"127.0.0.1\",0,3030,0", "OK", 1000, 0); //建立UDP服务
Ql_SendAT("AT+QISTATE=0,1", "OK", 1000, 0);
while ( (read_len = read(from_file, buf, MAXLINE)) > 0 ) //读取文件知道读完
{
printf("read_len = %d\n", read_len);
sprintf(str,"%d",read_len);