Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
HelloWorld
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZhongJianfu
HelloWorld
Commits
7844662b
Commit
7844662b
authored
Jul 14, 2022
by
ZhongJianfu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:更新
parent
f718a6d9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
137 additions
and
41 deletions
+137
-41
launch.json
.vscode/launch.json
+3
-2
main copy.cpp
main copy.cpp
+0
-12
main.cpp
main.cpp
+131
-0
maincpp111
maincpp111
+0
-0
scp_auto.sh
scp_auto.sh
+3
-27
No files found.
.vscode/launch.json
View file @
7844662b
...
@@ -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
main copy.cpp
deleted
100755 → 0
View file @
f718a6d9
#include <stdio.h>
#include "my_easylogging.h"
// #define HDDD
int
main
()
{
log_test
();
//日志自测函数 里面可以看细节的用法
LOG
(
INFO
)
<<
"》》》》》》》》》》打印测试11111《《《《《《《《"
;
printf
(
"Hello world
\n\r
"
);
return
0
;
}
main.cpp
0 → 100755
View file @
7844662b
#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
maincpp111
100755 → 100644
View file @
7844662b
File mode changed from 100755 to 100644
scp_auto.sh
View file @
7844662b
...
@@ -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/zjftes
t
spawn scp -r Build/bin/helloworld root@192.168.
1.177:/roo
t
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"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment