最新范文 方案 计划 总结 报告 体会 事迹 讲话 倡议书 反思 制度 入党

蓝牙电话网关系统综合开发-嵌入式实验报告

日期:2021-01-22  类别:最新范文  编辑:一流范文网  【下载本文Word版

蓝牙电话网关系统综合开发-嵌入式实验报告 本文关键词:蓝牙,网关,嵌入式,综合开发,实验

蓝牙电话网关系统综合开发-嵌入式实验报告 本文简介:11嵌入式系统实验报告姓名:宁昭义组数:第5组学号:152108061456专业:信息与通信工程日期:2015年12月20日综合实验(蓝牙电话网关系统综合开发案例)一、实验目的1.熟练建立交叉编译环境。2.了解蓝牙电话网关实现的原理。3.通过编程实现通过建立的蓝牙链接实现对GSM模块功能的控制。二、

蓝牙电话网关系统综合开发-嵌入式实验报告 本文内容:

11

嵌入式系统实验报告

姓名:宁昭义

组数:第5组

学号:152108061456

专业:信息与通信工程

日期:2015年12月20日

综合实验(蓝牙电话网关系统综合开发案例)

一、实验目的

1.熟练建立交叉编译环境。

2.了解蓝牙电话网关实现的原理。

3.通过编程实现通过建立的蓝牙链接实现对GSM模块功能的控制。

二、实验内容

1.前言

在蓝牙电话网关系统中,嵌入式主机起到主控作用,Bluetooth模块则向N个蓝牙电话终端设备提供语音接入功能,GSM/GPRS模块提供语音呼出服务,使得任何一个蓝牙电话终端的呼叫请求都能够连接到公众语音网络,从而实现本系统内部的蓝牙电话终端与外部公众语音通信网络用户的通信。

本开发案例构建了完整的蓝牙电话网关系统,系统组成结构如上图所示。嵌入式蓝牙电话网关是本系统的核心设备,主要使用了本产品中的ARM9嵌入式主机、Bluetooth

和GSM/GPRS通信模块。

本实验通过蓝牙建立无线连接,控制板载GSM模块拨打电话,示意图如下所示。

2.具体任务

1)

开发板1的蓝牙与开发板2的蓝牙建立语音和数据链路。

2)

设置开发板1,使开发板1能控制GSM模块拨打电话。

3)

开发板2通过建好的蓝牙链路控制开发板1的GSM模块拨打电话。

3.实验设备与软件环境

硬件:SemitARM9200开发板、PC机PIII800MHz,256MB以上、串口线(公母)1根、网线1根,音频线一对,7.5V电源1个,以上设备均需2套。

软件:RedHat

9.0

Linux操作系统,SemitARM9200实验开发软件。

三、实验步骤

分别将开发板1与开发板2的DEBUG

COM与PC1和PC2的串口相连,开发板的网口与PC的网口相连。开发板接7.5V电源。启动开发板1与开发板2,并建立交叉编译环境。

在开发板1上插入SIM卡,打开开发板1上GSM开关,按下GSM

RESET键复位GSM,等到GSM

MODE灯闪烁之后说明GSM模块已经启动成功。

开发板1与开发板2分别输入sh

/etc/scripts_arm.sh启动蓝牙

输入hciconfig显示蓝牙地址

在开发板1:

输入cd

/mnt/SEMIT_Project/Bluetooth_Cellphone/Bluetooth_Cellphone_Server进入文件夹

输入./server

开发板2:

输入cd

/mnt/SEMIT_Project/Bluetooth_Cellphone/Bluetooth_Cellphone_Client进入文件夹

输入./client

00:06:6e:17:1c:30

开发板2将通过蓝牙与开发板1建立链接,屏幕上将出现please

select

the

function字样代表已经可以控制开发板2的板载GSM模块拨打电话,按操作界面提示信息进行操作。

四、附录(程序)

Client端

#ifdef

HAVE_CONFIG_H

#include

#endif

#define

DEBUG

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

“bluetooth/bluetooth.h“#include

“bluetooth/hci.h“#include

“bluetooth/hci_lib.h“#include

“bluetooth/l2cap.h“#include

“bluetooth/sdp.h“#include

“bluetooth/sdp_lib.h“#include

“bluetooth/sco.h“#include

“bluetooth/tcs.h“void

baswap(bdaddr_tdst,const

bdaddr_tsrc)

{

register

unsigned

chard

=

(unsigned

char)

dst;

register

const

unsigned

chars

=

(const

unsigned

char)

src;

register

int

i;

for

(i

=

0;

i

“);

memset(cmd_line,0,50);

scanf(“%s“,cmd_line);

ch

=

cmd_line[0];

switch(ch)

{

case

1

:

printf(“please

enter

the

number

to

call/n>“);

memset(phonenum,0,sizeof(phonenum)

);

scanf(“%s“,phonenum);

phonenum[strlen(phonenum)]

=

0;

phonenum_len

=

strlen(phonenum);

memcpy(cmd_line+1,phonenum,phonenum_len);

nwrite

=

write(

s,cmd_line,sizeof(cmd_line)

);

sleep(1);

break;

case

2

:

nwrite

=

write(s,“2“,1);

sleep(1);

close(sco_s);

break;

case

3

:

nwrite

=

write(s,“3“,1);

printf(“exiting

./n“);

exit(0);

default:

break;

}

}

}

int

main(int

argc,char*argv[])

{

memset(phonenum,0,sizeof(phonenum));

debug(“beginingnow./n“);

//tcs_con_bt*

tcs;

//tcs->tcs_cur_state

=

STATE_NULL;

tcs_dt_init(argc,argv);

return

0;

}

Server端

#ifdef

HAVE_CONFIG_H

#include

#endif

#define

DEBUG

#include

#include

#include

#include

#include

#include

#include

#include

/*

File

control

definitions/

#include

/*

Error

number

definitions/

#include

/*

POSIX

terminal

control

definitions/

#include

/*

Mluti-programming

definitions*/

#include

“bluetooth/bluetooth.h“#include

“bluetooth/hci.h“#include

“bluetooth/hci_lib.h“#include

“bluetooth/l2cap.h“#include

“bluetooth/sdp.h“#include

“bluetooth/sdp_lib.h“#include

“bluetooth/sco.h“#include

“bluetooth/tcs.h“#define

MAX_LEN

32

For

debug

#ifdef

DEBUG

void

debug(char

str)

{

printf(str);

}

#else

#define

debug(str)

#endif

void

baswap(bdaddr_tdst,const

bdaddr_tsrc)

{

register

unsigned

chard

=

(unsigned

char)

dst;

register

const

unsigned

chars

=

(const

unsigned

char)

src;

register

int

i;

for

(i

=

0;

i

0)

{

switch(

buf[0]

)

{

case

1

:

//

gw_add_sco();

printf(“received

call

commands/n“);

printf(“phone

num

is

%s,len

is

%d/n“,buf+1,strlen(buf+1)

);

memset(send_cmd,0,sizeof(send_cmd));

memcpy(send_cmd,“ATD“,3);

memcpy(send_cmd+3,buf+1,strlen(buf+1)

);

send_cmd[

strlen(send_cmd)

]

=

;

;

send_cmd[

strlen(send_cmd)

]

=

0x0D

;

write(

fd,send_cmd,sizeof(send_cmd)

);

printf(“calling

GSM/n“);

break;

case

2

:

//gw_close_sco();

printf(“received

release

command/n“);

memset(send_cmd,0,sizeof(send_cmd));

memcpy(send_cmd,“ATH“,3);

send_cmd[strlen(send_cmd)]

=

0x0D;

write(

fd,send_cmd,sizeof(send_cmd)

);

printf(“call

released/n“);

break;

case

3

:

exit(0);

default:

break;

}

}

}

close(client);

close(s);

}

int

main()

{

char

c=0x41;

char

tmp_buf[25];

pid_t

pid;

debug(“beginingnow./n“);

tcs_state

=

STATE_NULL;

fd=open_port(fd,3);

set_opt(fd,115200,8,N,1);

tcs_init();

gw_process();

return

0;

}

    以上《蓝牙电话网关系统综合开发-嵌入式实验报告》范文由一流范文网精心整理,如果您觉得有用,请收藏及关注我们,或向其它人分享我们。转载请注明出处 »一流范文网»最新范文»蓝牙电话网关系统综合开发-嵌入式实验报告
‖大家正在看...
设为首页 - 加入收藏 - 关于范文吧 - 返回顶部 - 手机版
Copyright © 一流范文网 如对《蓝牙电话网关系统综合开发-嵌入式实验报告》有疑问请及时反馈。All Rights Reserved