Skip to content

Commit

Permalink
Merge pull request #1180 from fledge-iot/FOGL-8133
Browse files Browse the repository at this point in the history
FOGL-8133:
  • Loading branch information
AmandeepArora authored Oct 3, 2023
2 parents 65e648e + 76169f1 commit c0bd7d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 9 additions & 5 deletions C/services/north-plugin-interfaces/python/python_plugin_interface.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -414,18 +414,22 @@ uint32_t plugin_send_fn(PLUGIN_HANDLE handle, const std::vector<Reading *>& read
return numReadingsSent;
}

// Create a dict of readings
// 1 create a PythonReadingSet object
PythonReadingSet *pyReadingSet = (PythonReadingSet *) &readings;
// 1. create a ReadingSet
ReadingSet set(&readings);

// 2 create PyObject
// 2. create a PythonReadingSet object
PythonReadingSet *pyReadingSet = (PythonReadingSet *) &set;

// 3. create PyObject
PyObject* readingsList = pyReadingSet->toPython(true);

numReadingsSent = call_plugin_send_coroutine(pFunc, handle, readingsList);
Logger::getLogger()->debug("C2Py: plugin_send_fn():L%d: filtered readings sent %d",
__LINE__,
numReadingsSent);


set.clear(); // to avoid deletion of contained Reading objects; they are subsequently accessed in calling function DataSender::send()

// Remove python object
Py_CLEAR(readingsList);
Py_CLEAR(pFunc);
Expand Down
5 changes: 3 additions & 2 deletions scripts/services/north_C
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ fi

cd "${FLEDGE_ROOT}/services"
if [ "$runvalgrind" = "y" ]; then
file=$HOME/north.${name}.valgrind.out
file=${HOME}/north.${name}.valgrind.out
rm -f $file
valgrind --leak-check=full --trace-children=yes --log-file=$file ./fledge.services.north "$@"
valgrind --leak-check=full --trace-children=yes --show-leak-kinds=all --track-origins=yes --log-file=$file ./fledge.services.north "$@"
else
./fledge.services.north "$@"
fi

0 comments on commit c0bd7d1

Please sign in to comment.