linux下程式設計實現GPRS模組簡訊的收發和刪除

2021-06-25 08:38:07 字數 2539 閱讀 9061

這幾天搞gprs模組,雖然花費了些時間,但是也收穫了很多,從開始連gprs模組主要幹啥都不清楚,一點一點的查詢、學習。前面學習了通過串列埠用at命令實現了簡訊的收發和刪除。這幾天通過學習linux高階程式設計那本書和學習別人的文章、部落格,先是學習linux下串列埠程式設計,然後程式設計實現gprs模組簡訊的收發和刪除操作,為了除錯這幾天不知道用我的手機卡發了多少簡訊,不過總算搞定。

下面是實現**:

[root@root /]# ./my_msm_test 

this just be used to send english message

0.exit.

1.send   message.

2.read   message.

3.delete message.

enter your selete :

2nwrite=3,at

nread=9,at

oknwrite=10,at+cmgf=1

nread=16,at+cmgf=1

oknwrite=14,at+cscs="gsm"

nread=20,at+cscs="gsm"

okjust read  unread--message  please  input 1:

if you read just one message please input 2:

if you read all the  message please input 3:

input  what you want to do :

3nwrite=14,at+cmgl="all"

nread=512,at+cmgl="all"

+cmgl: 1,"rec read","+8613260579256","","14/09/01,10:26:39+32"

***xx

+cmgl: 2,"rec read","+8613260579256","","14/09/01,16:04:51+32"

hello world

+cmgl: 3,"rec read","+8613260579256","","14/09/01,16:07:58+32"

+cmgl: 4,"rec read","+8613260579256","","14/09/01,16:08:26+32"

+cmgl: 5,"rec read","+8613260579256","","14/09/01,16:10:49+32"

+cmgl: 6,"rec read","+8613260579256","","14/09/01,13:32:12+32"

ni hao

+cmgl: 7,"rec read","+8613260579256","","14/09/01,13:33:08+32"

at+cmgl="all"

[root@root /]# ./my_msm_test 

this just be used to send english message

0.exit.

1.send   message.

2.read   message.

3.delete message.

enter your selete :

2nwrite=3,at

nread=9,at

oknwrite=10,at+cmgf=1

nread=16,at+cmgf=1ok

nwrite=14,at+cscs="gsm"

nread=20,at+cscs="gsm"

okjust read  unread--message  please  input 1:

if you read just one message please input 2:

if you read all the  message please input 3:

input  what you want to do :

2please input the number you want to read:6

nwrite=10,at+cmgr=6

nread=88,at+cmgr=6

+cmgr: "rec read","+8613260579256","","14/09/01,13:32:12+32"

ni haook

[root@root /]# ./my_msm_test 

this just be used to send english message

0.exit.

1.send   message.

2.read   message.

3.delete message.

enter your selete :

3nwrite=3,at

nread=9,at

okplease input the number you want to delete:8

nwrite=10,at+cmgd=8

nread=16,at+cmgd=8

ok

Linux 下串列埠程式設計 程式設計實現

在 linux 下串列埠檔案是位於 dev 下的 開啟串列埠是通過使用標準的檔案開啟函式open操作 include include include include include include include include static int fd int uart open int fd,...

Linux下實現RPC程式設計

linux 下面使用rpc需要使用到命令rpcgen.在linux下開發rpc程式流程如下 1.寫乙個rpc程式 如test.x 2.使用rpcgen生成必須的檔案,通常是客戶端和伺服器端以及標頭檔案 rpcgen test.x 3.使用rpcgen生成伺服器端和客戶端的c語言 rpcgen ss ...

Linux下程式設計

windows下我的環境為 windows10 vs2015 opencv3.4.0 opencv3.4.0 contrib python linux下我的環境為 ubuntu16004 也有ubuntu1804 opencv3.4.0 opencv3.4.0 contrib python gnu ...