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
ea7be1d9
Commit
ea7be1d9
authored
Feb 28, 2022
by
Joshua Supra
Browse files
added get date function
parent
bb749943
Changes
4
Hide whitespace changes
Inline
Side-by-side
main.c
View file @
ea7be1d9
...
...
@@ -91,7 +91,6 @@ int main (int argc, char *argv[]){
* TEST Functions
**************************************************************************/
/**************************************************************************
...
...
pilc2_functions/libpilc2.a
View file @
ea7be1d9
No preview for this file type
pilc2_functions/pilc2_network.c
View file @
ea7be1d9
...
...
@@ -89,6 +89,7 @@ int FunctionCall(zmq_data *zmq_data_struct){
case
GET_DATA
:
value
=
PiLC2GetRamData
(
funcArg
[
0
],
funcArg
[
1
],
zmq_data_struct
->
socket
);
break
;
case
GET_IO_CARDS
:
value
=
PiLC2GetIOCards
(
zmq_data_struct
);
break
;
case
GET_PILC_INET
:
value
=
getPiLCinet
(
zmq_data_struct
);
break
;
case
GET_DATE
:
value
=
GetDate
(
zmq_data_struct
);
break
;
case
INIT_IO_CARDS
:
PiLC2InitIOCards
();
break
;
}
if
(
value
==
1
){
...
...
@@ -472,3 +473,27 @@ void PiLC2InitIOCards(void) {
InitIOCards
(
IOCards
);
}
int
GetDate
(
zmq_data
*
zmq_data_struct
)
{
unsigned
int
*
buffer
;
buffer
=
(
unsigned
int
*
)
malloc
(
6
*
sizeof
(
int
));
time_t
rawtime
=
time
(
NULL
);
struct
tm
*
ptm
=
localtime
(
&
rawtime
);
buffer
[
0
]
=
ptm
->
tm_year
+
1900
;
buffer
[
1
]
=
ptm
->
tm_mon
+
1
;
buffer
[
2
]
=
ptm
->
tm_mday
;
buffer
[
3
]
=
ptm
->
tm_hour
;
buffer
[
4
]
=
ptm
->
tm_min
;
buffer
[
5
]
=
ptm
->
tm_sec
;
//printf("%i \n", buffer[1]);
zmq_send
(
zmq_data_struct
->
socket
,
buffer
,
42
,
0
);
free
(
buffer
);
return
0
;
}
pilc2_functions/pilc2_network.h
View file @
ea7be1d9
...
...
@@ -18,7 +18,7 @@
#define GET_DATA 0x5
#define GET_IO_CARDS 0x6
#define GET_PILC_INET 0x7
#define GET_DATE 0x8
#define INIT_IO_CARDS 0x9
typedef
struct
{
...
...
@@ -43,6 +43,7 @@ int GetNrOfData(zmq_data *zmq_data_struct);
int
PiLC2GetRamData
(
unsigned
int
RAMBaseAddress
,
unsigned
int
numofdata
,
void
*
socket
);
int
PiLC2GetIOCards
(
zmq_data
*
zmq_data_struct
);
int
getPiLCinet
(
zmq_data
*
zmq_data_struct
);
int
GetDate
(
zmq_data
*
zmq_data_struct
);
void
PiLC2InitIOCards
(
void
);
void
*
context
;
...
...
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