if(isatty(STDIN_FILENO) == 0)
printf("\rstandard input is not a terminal device\n");
else
printf("isatty success!\n");
printf("\rfd-open=%d\n",fd);
return fd;
}
static int Get_Parameter(int fd)
{
printf("Get Bluetooth Parameter\n");
//printf("Get parameter : \n");
// printf("Device Name : \n");
Serial_Tran(fd, "AT+NAME?\r\n"); //询查设备名称
//printf("BAUD : \n");
Serial_Tran(fd, "AT+BAUD?\r\n"); //查询波特率
//printf("Device Bind : \n");
Serial_Tran(fd, "AT+BIND?\r\n"); // 查询设备绑定
//printf("Device Class : \n");
Serial_Tran(fd, "AT+CLASS?\r\n") ; //查询类别
//printf("Device Authority : \n");
Serial_Tran(fd, "AT+SNIFF?\r\n"); //查询是否需要鉴权
//printf("Device PassWord : \n");
Serial_Tran(fd, "AT+PASSWORD?\r\n"); //查询鉴权密码
//printf("Device Role : \n");
Serial_Tran(fd, "AT+ROLE?\r\n"); // 查询设备角色
//printf("Device Sniff State: \n");
Serial_Tran(fd, "AT+SNIFF?\r\n"); //查询节能状态
//printf("Device ScanTime : \n");
Serial_Tran(fd, "AT+SCANTIME?\r\n"); //查寻扫描与连接参数
//printf("Program Version : \n");
Serial_Tran(fd, "AT+VERSION?\r\n"); //查询程序版本号
//printf("Device LED : ");
Serial_Tran(fd, "AT+LED?\r\n"); // 查询指示灯
//printf("Remote Device Address : ");
Serial_Tran(fd, "AT+RADDR?\r\n"); //查询远端设备地址
//printf("Local Device Address : ");
Serial_Tran(fd, "AT+LADDR?\r\n"); //查询本地设备地址
//printf("Device UartMode : \n");
Serial_Tran(fd, "AT+UARTMODE?\r\n"); //查询串口通信模式
//printf("Device LowPower : \n");
Serial_Tran(fd, "AT+LOWPOWER?\r\n"); //查询设备低功?
return 0;
}
static int Set_Parameter(int fd)
{
int i, sel, num;
printf("\rIf you want to set vironment?please input 1\n");
printf("\rENTER : ");
//if(!GetIntNumber(&label))
scanf("%d",&num);
if (num== 1)
{
while(1)
{
printf("\rSelect :\n");
for(i=0; Functions[i].FuncAddr; i++)
{
printf("\r%2d : %s\n", i, Functions[i].str);
}
printf("\rEnter your selection: ");
scanf("%d",&sel);
if(sel==8)
{
break;
}
if(sel>=0&&sel<i)
{
(*Functions[sel].FuncAddr)(downloadAddress, downloadFileSize);
}
}
}
else
{
return 0;
}
}