Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
embedded-linux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Maul
embedded-linux
Commits
3159f224
Commit
3159f224
authored
4 months ago
by
Leon Bohnwagner
Browse files
Options
Downloads
Patches
Plain Diff
feat: add dummy client
parent
dcf30472
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
clients/CMakeLists.txt
+1
-0
1 addition, 0 deletions
clients/CMakeLists.txt
clients/dummy/CMakeLists.txt
+8
-0
8 additions, 0 deletions
clients/dummy/CMakeLists.txt
clients/dummy/src/dummy.c
+47
-0
47 additions, 0 deletions
clients/dummy/src/dummy.c
with
56 additions
and
0 deletions
clients/CMakeLists.txt
+
1
−
0
View file @
3159f224
add_subdirectory
(
cpu_temp
)
add_subdirectory
(
dummy
)
This diff is collapsed.
Click to expand it.
clients/dummy/CMakeLists.txt
0 → 100644
+
8
−
0
View file @
3159f224
add_executable
(
dummy
src/dummy.c
)
target_link_libraries
(
dummy
PRIVATE common
m
)
This diff is collapsed.
Click to expand it.
clients/dummy/src/dummy.c
0 → 100644
+
47
−
0
View file @
3159f224
#include
"../../../common/include/measurement.h"
#include
"../../../common/include/userspace_comm.h"
#include
<fcntl.h>
#include
<math.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<sys/stat.h>
#include
<sys/types.h>
#include
<unistd.h>
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
3
||
argc
>
3
)
{
printf
(
"Invalid arguments provided"
);
return
EXIT_FAILURE
;
}
userspace_send_handle_t
userspace_send_handle
;
if
(
create_userspace_send_handle
(
&
userspace_send_handle
)
==
-
1
)
{
perror
(
"Failed to open message queue"
);
return
EXIT_FAILURE
;
}
double
step
=
0
.
0
;
int
sleep_ms
=
atoi
(
argv
[
2
]);
while
(
1
)
{
measurement_t
measurement
=
{
.
data
.
float64
=
sin
(
step
),
.
datatype
=
FLOAT64
,
.
id
=
atoi
(
argv
[
1
]),
};
send_userspace_message
(
&
userspace_send_handle
,
measurement
);
step
+=
0
.
01
;
if
(
step
>=
2
.
0
*
M_PI
)
{
step
=
0
.
0
;
}
usleep
(
sleep_ms
*
1000
);
}
destroy_userspace_send_handle
(
&
userspace_send_handle
);
return
EXIT_SUCCESS
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment