-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* builds cleanly * calypso working see nanomq issue! probably not from calypso * initial plugin support * basic plugin and support still cant find symbols via buildroot, plugin tested on debian. * remove upstream header * add nanomq plugin ability actually works on buildroot so happy * add nanomq and calypso to nero * vital fixups * important: switch to pid forking of nanomq * bump calypso version * fixes nanomq bug (#79) by some miracle * bump nanomq version * add comments to the timestamp plugin
- Loading branch information
Showing
14 changed files
with
225 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
odysseus/odysseus_tree/board/tpu/plugin_user_property_timestamp.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <sys/time.h> | ||
|
||
|
||
#include "nanomq/plugin.h" | ||
|
||
// upstream calls this function and accesses property from the data variable, then frees the properties after message is sent | ||
int cb(void *data) | ||
{ | ||
char **property = data; | ||
if (property != NULL) { | ||
|
||
// key of ts, add 1 bc termination byte | ||
property[0] = malloc(strlen("ts") + 1); | ||
strcpy(property[0], "ts"); | ||
|
||
|
||
// the below is used to get the time in miliseconds, required since there is no api for milisecond precision | ||
struct timeval tv; | ||
|
||
gettimeofday(&tv, NULL); | ||
|
||
// do the math to get the miliseconds since unix epoch | ||
unsigned long long millisecondsSinceEpoch = | ||
(unsigned long long)(tv.tv_sec) * 1000 + | ||
(unsigned long long)(tv.tv_usec) / 1000; | ||
|
||
// currently the time is using 13 characters, so 30 should be enough | ||
char str[30]; | ||
// convert the epoch time to a char arr | ||
sprintf(str, "%llu", millisecondsSinceEpoch); | ||
|
||
// value of the time, add 1 bc termination byte | ||
property[1] = malloc(strlen(str)+1); | ||
strcpy(property[1], str); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
int nano_plugin_init() | ||
{ | ||
plugin_hook_register(HOOK_USER_PROPERTY, cb); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
odysseus/odysseus_tree/overlays/rootfs_overlay_can_common/etc/init.d/S70socketcand
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#! /bin/sh | ||
|
||
### BEGIN INIT INFO | ||
# Provides: socketcand | ||
# Required-Start: $remote_fs | ||
# Required-Stop: $remote_fs | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: | ||
# Short-Description: socketcand | ||
# Description: daemon that provides network access to local CAN busses | ||
### END INIT INFO | ||
|
||
[ -f /etc/default/rcS ] && . /etc/default/rcS | ||
PATH=/bin:/usr/bin:/sbin:/usr/sbin | ||
prefix=@prefix@ | ||
exec_prefix=@exec_prefix@ | ||
DAEMON=@bindir@/socketcand | ||
DESC="SocketCAN daemon" | ||
NAME="socketcand" | ||
PIDFILE=/var/run/socketcand.pid | ||
|
||
test -x $DAEMON || exit 0 | ||
|
||
case "$1" in | ||
start) | ||
echo "Starting $DESC" "$NAME" | ||
start-stop-daemon --start --quiet --background --pidfile $PIDFILE --startas $DAEMON -m -- --daemon | ||
;; | ||
stop) | ||
echo "Stopping $DESC" "$NAME" | ||
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --startas $DAEMON | ||
rm -f $PIDFILE | ||
;; | ||
status) | ||
printf "%-50s" "Checking $NAME..." | ||
if [ -f $PIDFILE ]; then | ||
PID=`cat $PIDFILE` | ||
if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then | ||
printf "%s\n" "Process dead but pidfile exists" | ||
return 1 | ||
else | ||
echo "Running" | ||
return 0 | ||
fi | ||
else | ||
printf "%s\n" "Service not running" | ||
return 1 | ||
fi | ||
;; | ||
restart) | ||
$0 stop | ||
sleep 1 | ||
$0 start | ||
;; | ||
force-reload) | ||
if start-stop-daemon --stop --test --quiet --pidfile $PIDFILE --startas $DAEMON ; then | ||
$0 restart | ||
fi | ||
;; | ||
*) | ||
echo "Usage: /etc/init.d/socketcand {start|stop|restart|force-reload}" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
config BR2_PACKAGE_CALYPSO | ||
bool "calypso" | ||
depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS | ||
depends on BR2_PACKAGE_OPENSSL | ||
select BR2_PACKAGE_HOST_RUSTC | ||
select BR2_PACKAGE_SOCKETCAND | ||
help | ||
The NER CAN message decoding software. | ||
|
||
Written in Rust, utlizing socketcand. | ||
|
||
https://github.com/Northeastern-Electric-Racing/Calypso |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
|
||
PIDFILE=/var/run/calypso.pid | ||
EXECUTABLE=/usr/bin/calypso | ||
INTERFACE_NAME=can0 | ||
|
||
case "$1" in | ||
start) | ||
echo "Starting calypso..." | ||
# start (S) executable (x) in background (b), make pid file (m) at p | ||
start-stop-daemon -S -x "$EXECUTABLE" -b -m -p "$PIDFILE" -- mqtt localhost:1883 $INTERFACE_NAME skip_can_configure | ||
;; | ||
stop) | ||
echo "Stopping calypso..." | ||
# stop (K) and remove pidfile | ||
start-stop-daemon -K -p "$PIDFILE" | ||
rm "$PIDFILE" | ||
;; | ||
restart|reload) | ||
"$0" stop | ||
"$0" start | ||
;; | ||
*) | ||
echo "Usage: {start|stop|restart/reload}" | ||
exit 1 | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CALYPSO_VERSION = 684379919866ee2c15e824486305b916ecd4d344 | ||
CALYPSO_SITE_METHOD = git | ||
CALYPSO_SITE = https://github.com/Northeastern-Electric-Racing/Calypso | ||
CALYPSO_DEPENDENCIES += openssl | ||
|
||
define CALYPSO_INSTALL_INIT_SYSV | ||
$(INSTALL) -D -m 0755 $(BR2_EXTERNAL_ODY_TREE_PATH)/package/calypso/S76calypso $(TARGET_DIR)/etc/init.d/S76calypso | ||
endef | ||
|
||
$(eval $(cargo-package)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,3 @@ NRC7292_POST_BUILD_HOOKS += NRC7292_BUILD_DTO | |
|
||
$(eval $(kernel-module)) | ||
$(eval $(generic-package)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,3 @@ NRC7394_POST_BUILD_HOOKS += NRC7394_BUILD_DTO | |
|
||
$(eval $(kernel-module)) | ||
$(eval $(generic-package)) | ||
|