Commit 7844662b by ZhongJianfu

update:更新

parent f718a6d9
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"text1": "-gdb-set follow-fork-mode child" "text1": "-gdb-set follow-fork-mode child"
} }
], ],
"miDebuggerPath": "/home/lkt/Soft_packet/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gdb", // "miDebuggerPath": "/home/lkt/Soft_packet/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gdb",
"miDebuggerServerAddress": "192.168.2.15:2222" // "miDebuggerServerAddress": "192.168.2.15:2222"
}] }]
} }
\ No newline at end of file
#include <stdio.h>
#include "my_easylogging.h"
// #define HDDD
int main()
{
log_test(); //日志自测函数 里面可以看细节的用法
LOG(INFO) << "》》》》》》》》》》打印测试11111《《《《《《《《";
printf("Hello world\n\r");
return 0;
}
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <termios.h>
#include <sys/types.h>
#include <poll.h>
#include "my_easylogging.h"
int ttyfd;
int stdout_changed = 0;
int tty_changed = 0;
struct termios stdout_tio;
struct termios tty_tio;
using namespace std;
string get_sim_num();
int set_blue_alarm_led(int value);
int main(int args, const char *argv[])
{
// if (args != 2)
// {
// fprintf(stderr, "Usage: ./sendat ttyUSB\n");
// exit(EXIT_FAILURE);
// }
easylogginginit(); //日志初始化
// get_sim_num();
set_blue_alarm_led(1);
return 0;
}
/**
* @brief Get the sim num object
* 获取sim卡号 若格网关
* @return string
*/
string get_sim_num()
{
string sim_num;
char readbuf[256];
ttyfd = open("/dev/ttyUSB1", O_RDWR | O_NOCTTY | O_NDELAY);
if (ttyfd < 0)
{
perror("open");
exit(EXIT_FAILURE);
}
int ret = write(ttyfd, "AT+ICCID\r\n", 10);
if (ret < 0)
{
perror("write");
exit(EXIT_FAILURE);
}
usleep(100 * 1000);
ret = read(ttyfd, readbuf, sizeof(readbuf));
if (ret < 0 && errno != EAGAIN)
{
perror("read");
exit(EXIT_FAILURE);
}
// LOG(INFO) << "ret = " << ret;
LOG(INFO) << "readbuf =" << readbuf;
for (int i = 0; i < ret; i++)
{
if (readbuf[i] >= 0x30 && readbuf[i] <= 0x39)
{
sim_num.push_back(readbuf[i]);
}
}
LOG(INFO) << "sim_num = " << sim_num;
LOG(INFO) << "sim_num.size = " << sim_num.size();
// if (ret > 0)
// write(ttyfd, "AT+ICCID\r\n", 10);
// sim_num =to_string()
return sim_num;
}
/*
+ICCID: 89860621330066521767
OK
*/
/**
* @brief Set the red alarm led object
* 蓝色表示 柴油发电机 水温高报警
* 报警灯的黄色接到 网关DO2端 echo 1 > /sys/class/gpio/gpio53/value
* @param value 1 启动 0关闭
* @return string
*/
int set_blue_alarm_led(int value)
{
// string diesel_oil_level_sensor_2_status;
// char readbuf[256];
int ttyfd = open("/sys/class/gpio/gpio53/value", O_RDWR);
if (ttyfd < 0)
{
return 0;
}
if (value > 0)
{
//开启报警灯
int ret = write(ttyfd, "1", 1);
if (ret < 0)
{
close(ttyfd);
return 0;
}
}
else
{
// 关闭报警灯
int ret = write(ttyfd, "0", 1);
if (ret < 0)
{
close(ttyfd);
return 0;
}
}
close(ttyfd);
return 0;
}
\ No newline at end of file
File mode changed from 100755 to 100644
...@@ -3,36 +3,12 @@ project_path=$( ...@@ -3,36 +3,12 @@ project_path=$(
cd $(dirname $0) cd $(dirname $0)
pwd pwd
) )
project_name="${project_path##*/}"
# #存放要传输目标文件的路径
# cd $project_path/Build/bin
# #配置目标设备的地址和文件还有密码
# expect -c "
# spawn scp -r xDC root@192.168.0.139:/opt/FCIMS/
# expect {
# \"*assword\" {set timeout 300; send \"hzxy123\r\"; exp_continue;}
# \"yes/no\" {send \"yes\r\";}
# }
# expect eof"
#存放要传输目标文件的路径
cd $project_path
#配置目标设备的地址和文件还有密码 #配置目标设备的地址和文件还有密码
expect -c " expect -c "
spawn scp -r Build/bin/helloworld root@192.168.2.15:/home/root/zjftest spawn scp -r Build/bin/helloworld root@192.168.1.177:/root
expect { expect {
\"yes/no\" {send \"yes\r\";} \"yes/no\" {send \"yes\r\";}
\"*assword\" {set timeout 300; send \"1\r\"; exp_continue;}
} }
expect eof" expect eof"
# expect -c "
# spawn scp -r FCIMS root@192.168.0.115:/home/root/zjftest
# expect {
# \"*assword\" {set timeout 300; send \"hzxy123\r\"; exp_continue;}
# \"yes/no\" {send \"yes\r\";}
# }
# expect eof"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment