Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FS-ELAB
pilc2server_old
Commits
68c91288
Commit
68c91288
authored
Feb 28, 2022
by
Joshua Supra
Browse files
added eth1 link status to getDate
parent
ea7be1d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
pilc2_functions/libpilc2.a
View file @
68c91288
No preview for this file type
pilc2_functions/pilc2_network.c
View file @
68c91288
...
...
@@ -477,7 +477,7 @@ void PiLC2InitIOCards(void) {
int
GetDate
(
zmq_data
*
zmq_data_struct
)
{
unsigned
int
*
buffer
;
buffer
=
(
unsigned
int
*
)
malloc
(
6
*
sizeof
(
int
));
buffer
=
(
unsigned
int
*
)
malloc
(
7
*
sizeof
(
int
));
time_t
rawtime
=
time
(
NULL
);
...
...
@@ -489,11 +489,26 @@ int GetDate(zmq_data *zmq_data_struct) {
buffer
[
3
]
=
ptm
->
tm_hour
;
buffer
[
4
]
=
ptm
->
tm_min
;
buffer
[
5
]
=
ptm
->
tm_sec
;
buffer
[
6
]
=
CheckLink
();;
//printf("%i \n", buffer[1]);
zmq_send
(
zmq_data_struct
->
socket
,
buffer
,
4
2
,
0
);
zmq_send
(
zmq_data_struct
->
socket
,
buffer
,
4
6
,
0
);
free
(
buffer
);
return
0
;
}
int
CheckLink
(
void
)
{
char
*
ifname
=
"eth1"
;
int
socId
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_IP
);
struct
ifreq
if_req
;
(
void
)
strncpy
(
if_req
.
ifr_name
,
ifname
,
sizeof
(
if_req
.
ifr_name
));
ioctl
(
socId
,
SIOCGIFFLAGS
,
&
if_req
);
close
(
socId
);
return
(
if_req
.
ifr_flags
&
IFF_UP
)
&&
(
if_req
.
ifr_flags
&
IFF_RUNNING
);
}
pilc2_functions/pilc2_network.h
View file @
68c91288
...
...
@@ -45,7 +45,7 @@ int PiLC2GetIOCards(zmq_data *zmq_data_struct);
int
getPiLCinet
(
zmq_data
*
zmq_data_struct
);
int
GetDate
(
zmq_data
*
zmq_data_struct
);
void
PiLC2InitIOCards
(
void
);
int
CheckLink
(
void
);
void
*
context
;
void
*
client_responder
;
void
*
gui_responder
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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