get data from Kernel driver
1st version of the json file with the header
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Markus Lehr.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Owend property of Markus Lehr
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RTS_INCLUDE_ICHANNELDESC_H_
|
||||||
|
#define RTS_INCLUDE_ICHANNELDESC_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
enum VALUEFORMAT {
|
||||||
|
UINT32 = 0,
|
||||||
|
INT32,
|
||||||
|
FLOAT,
|
||||||
|
DOUBLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class IChannelDesc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
virtual u_int32_t GetId() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
virtual const std::string& GetName() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
virtual VALUEFORMAT GetValueFormat() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return the length of the data that is neeeded for one value of the channel in UINT32
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
virtual u_int32_t GetValueByteSpace() = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* RTS_INCLUDE_ICHANNELDESC_H_ */
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Markus Lehr.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Owend property of Markus Lehr
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef RTS_INCLUDE_ISENSORDESC_H_
|
||||||
|
#define RTS_INCLUDE_ISENSORDESC_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
#include <json.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ISensorDesc
|
||||||
|
{
|
||||||
|
|
||||||
|
virtual int GetDescription() = 0;
|
||||||
|
|
||||||
|
virtual bool Add2Json(json& j) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* RTS_INCLUDE_ISENSORDESC_H_ */
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
*/
|
* Copyright (c) 2024 Markus Lehr.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Owend property of Markus Lehr
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RTS_INCLUDE_RTSCOPROHELPER_H_
|
||||||
|
#define RTS_INCLUDE_RTSCOPROHELPER_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -35,3 +43,5 @@ private:
|
|||||||
int Copro_setFwName(const char* nameStr);
|
int Copro_setFwName(const char* nameStr);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* RTS_INCLUDE_RTSCOPROHELPER_H_ */
|
||||||
@@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
*/
|
* Copyright (c) 2024 Markus Lehr.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Owend property of Markus Lehr
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RTS_INCLUDE_RTSMONFRAME_H_
|
||||||
|
#define RTS_INCLUDE_RTSMONFRAME_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <ISensorDesc.h>
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
class RTSMonFrame
|
class RTSMonFrame
|
||||||
{
|
{
|
||||||
@@ -14,59 +24,35 @@ private:
|
|||||||
int samplerate;
|
int samplerate;
|
||||||
int sampleperiod;
|
int sampleperiod;
|
||||||
int downtime;
|
int downtime;
|
||||||
std::string status;
|
std::list<std::shared_ptr<ISensorDesc>> mSenorDesriptions;
|
||||||
std::list<std::string> items;
|
std::string path;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RTSMonFrame(int id, std::string name, int samplerate, int sampleperiod, int downtime, std::string status) {
|
RTSMonFrame(int id, std::string name, int samplerate, int sampleperiod, int downtime, const std::list<std::shared_ptr<ISensorDesc>>& sensDesc, std::string path);
|
||||||
this->id = id;
|
|
||||||
this->name = name;
|
|
||||||
this->samplerate = samplerate;
|
|
||||||
this->sampleperiod = sampleperiod;
|
|
||||||
this->downtime = downtime;
|
|
||||||
this->status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
RTSMonFrame(int id) {
|
|
||||||
this->id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
RTSMonFrame(RTSMonFrame& rtsMonFrameCopy) {
|
|
||||||
this->id = rtsMonFrameCopy.GetId();
|
|
||||||
}
|
|
||||||
|
|
||||||
~RTSMonFrame();
|
~RTSMonFrame();
|
||||||
|
|
||||||
void Add(std::string item){
|
int GetId();
|
||||||
this->items.push_back(item);
|
|
||||||
}
|
|
||||||
int GetId() {
|
|
||||||
return this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string GetName() {
|
void SetName(const std::string& name);
|
||||||
return this->name;
|
|
||||||
}
|
const std::string& GetName();
|
||||||
|
|
||||||
int GetSampleRate() {
|
void SetSampleRate(int samplerate);
|
||||||
return this->samplerate;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetSamplePeriod(){
|
int GetSampleRate();
|
||||||
return this->sampleperiod;
|
|
||||||
}
|
void SetSamplePeriod(int sampleperiod);
|
||||||
|
|
||||||
|
int GetSamplePeriod();
|
||||||
|
|
||||||
int GetDownTime(){
|
void SetDownTime(int downtime);
|
||||||
return this->downtime;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Gettatus() {
|
|
||||||
return this->status;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::list<std::string>& GetItems() {
|
int GetDownTime();
|
||||||
return this->items;
|
|
||||||
}
|
bool generate(u_int32_t* values);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* RTS_INCLUDE_RTSMONFRAME_H_ */
|
||||||
@@ -1,13 +1,68 @@
|
|||||||
/*
|
/*
|
||||||
*/
|
* Copyright (c) 2024 Markus Lehr.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Owend property of Markus Lehr
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RTS_INCLUDE_RTSMONITORINGTASK_H_
|
||||||
|
#define RTS_INCLUDE_RTSMONITORINGTASK_H_
|
||||||
|
|
||||||
#include "RTSCoproHelper.h"
|
#include "RTSCoproHelper.h"
|
||||||
#include "RTSMonFrame.h"
|
#include "RTSMonFrame.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/eventfd.h>
|
||||||
|
#include <sys/poll.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <regex.h>
|
||||||
|
#include <sched.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <termios.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <error.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define NB_BUF 1
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int bufferId, eventfd;
|
||||||
|
} rpmsg_sdb_ioctl_set_efd;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int bufferId;
|
||||||
|
uint32_t size;
|
||||||
|
} rpmsg_sdb_ioctl_get_data_size;
|
||||||
|
|
||||||
|
|
||||||
|
struct vRCMDeviceData {
|
||||||
|
uint32_t packageNo; //current package Number
|
||||||
|
uint32_t packageCount; //complete package Number
|
||||||
|
uint32_t dataQuantity; //number of uint32_t in data
|
||||||
|
uint32_t data[]; //the data
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class RTSMonitoringTask
|
class RTSMonitoringTask
|
||||||
{
|
{
|
||||||
@@ -15,13 +70,35 @@ private:
|
|||||||
/* data */
|
/* data */
|
||||||
//lock Element
|
//lock Element
|
||||||
|
|
||||||
|
//std::map<int, RTSMonFrame*> rtsMonFrames;
|
||||||
|
pthread_t monThread;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* The file descriptor used to manage our TTY over RPMSG */
|
/* The file descriptor used to manage our TTY over RPMSG */
|
||||||
int mFdRpmsg[2] = {-1, -1};
|
int mFdRpmsg[2] = {-1, -1};
|
||||||
RTSCoproHelper coproHelper;
|
RTSCoproHelper coproHelper;
|
||||||
|
/* The file descriptor used to manage our SDB over RPMSG */
|
||||||
|
int mFdSdbRpmsg = -1;
|
||||||
|
|
||||||
std::map<int, RTSMonFrame*> rtsMonFrames;
|
rpmsg_sdb_ioctl_get_data_size q_get_data_size;
|
||||||
|
|
||||||
pthread_t monThread;
|
rpmsg_sdb_ioctl_set_efd q_set_efd;
|
||||||
|
|
||||||
|
int mefd[NB_BUF];
|
||||||
|
void* mmappedData[NB_BUF];
|
||||||
|
bool mfMappedData = false;
|
||||||
|
struct pollfd mfds[NB_BUF];
|
||||||
|
//uint8_t mDdrBuffAwaited = 1;
|
||||||
|
uint32_t mNbUncompData=0;
|
||||||
|
uint32_t mNbWrittenInFileData;
|
||||||
|
uint32_t mNbUncompMB=0;
|
||||||
|
uint32_t mNbPrevUncompMB=0;
|
||||||
|
uint32_t mNbTty0Frame=0;
|
||||||
|
char mByteBuffCpy[512];
|
||||||
|
struct timeval tval_before, tval_after, tval_result;
|
||||||
|
|
||||||
|
std::atomic_bool mRunThread= true;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -30,13 +107,24 @@ public:
|
|||||||
|
|
||||||
//static RTSMonitoringTask& Instance();
|
//static RTSMonitoringTask& Instance();
|
||||||
bool Init();
|
bool Init();
|
||||||
bool CreateMonitoring(int id, std::string name, int samplerate, int sampleperiod, int downtime, std::string status);
|
//bool CreateMonitoring(int id, std::string name, int samplerate, int sampleperiod, int downtime, std::string status);
|
||||||
bool LoadFW();
|
bool LoadFW();
|
||||||
bool Start();
|
bool Start();
|
||||||
bool Stop();
|
bool Stop();
|
||||||
|
|
||||||
|
int Open(std::string monfilename);
|
||||||
|
bool Close();
|
||||||
|
std::string Read();
|
||||||
|
bool GetRunState();
|
||||||
|
void SetRunState(bool runThread);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void* Run(void *obj);
|
static void* Run(void *obj);
|
||||||
bool Load();
|
bool Load();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* RTS_INCLUDE_RTSMONITORINGTASK_H_ */
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Markus Lehr.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Owend property of Markus Lehr
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RTS_INCLUDE_VIBCHANNELDESC_H_
|
||||||
|
#define RTS_INCLUDE_VIBCHANNELDESC_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
#include <IChannelDesc.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class VibChannelDesc : IChannelDesc
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
u_int32_t id;
|
||||||
|
std::string name;
|
||||||
|
VALUEFORMAT valueFormat;
|
||||||
|
u_int32_t vByteSpace;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
VibChannelDesc(u_int32_t id, const std::string& name, VALUEFORMAT valueFormat, u_int32_t vByteSpace = 1);
|
||||||
|
|
||||||
|
u_int32_t GetId() override;
|
||||||
|
|
||||||
|
|
||||||
|
const std::string& GetName() override;
|
||||||
|
|
||||||
|
|
||||||
|
VALUEFORMAT GetValueFormat() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return the length of the data that is neeeded for one value of the channel in UINT32
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
u_int32_t GetValueByteSpace() override;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* RTS_INCLUDE_VIBCHANNELDESC_H_ */
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Markus Lehr.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Owend property of Markus Lehr
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RTS_INCLUDE_VIBSENSORDESC_H_
|
||||||
|
#define RTS_INCLUDE_VIBSENSORDESC_H_
|
||||||
|
|
||||||
|
#include <ISensorDesc.h>
|
||||||
|
#include <IChannelDesc.h>
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
#include <json.hpp>
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
|
||||||
|
class VibSensorDesc: public ISensorDesc
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
std::list<std::shared_ptr<IChannelDesc>> mDescriptions;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
VibSensorDesc();
|
||||||
|
|
||||||
|
virtual int GetDescription() override;
|
||||||
|
virtual bool Add2Json(json& j) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* RTS_INCLUDE_VIBSENSORDESC_H_ */
|
||||||
@@ -12,9 +12,12 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) {
|
|||||||
// idle
|
// idle
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
rtMon.CreateMonitoring(1, "Test1", 3750, 2, 10, "stopped");
|
|
||||||
|
//rtMon.CreateMonitoring(1, "Test1", 3750, 2, 10, "stopped");
|
||||||
// sleep 100 ms
|
// sleep 100 ms
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(60000));
|
||||||
|
rtMon.SetRunState(false);
|
||||||
|
//printf("CA7 : Terminate RTService\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -0,0 +1,216 @@
|
|||||||
|
/*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <RTSMonFrame.h>
|
||||||
|
#include <json.hpp>
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <boost/filesystem/path.hpp>
|
||||||
|
#include <boost/filesystem/operations.hpp>
|
||||||
|
|
||||||
|
static const std::string RTSMONID("id");
|
||||||
|
static const std::string RTSMONNAME("name");
|
||||||
|
static const std::string RTSMONSRATE("samplerate");
|
||||||
|
static const std::string RTSMONSPERIOD("sampleperiod");
|
||||||
|
static const std::string RTSMONDTIME("downtime");
|
||||||
|
static const std::string RTSMONTIMESTAMP("timestamp");
|
||||||
|
|
||||||
|
using namespace std::chrono;
|
||||||
|
|
||||||
|
|
||||||
|
RTSMonFrame::RTSMonFrame(int id, std::string name, int samplerate, int sampleperiod, int downtime, const std::list<std::shared_ptr<ISensorDesc>>& sensDesc, std::string path) {
|
||||||
|
this->id = id;
|
||||||
|
this->name = name;
|
||||||
|
this->samplerate = samplerate;
|
||||||
|
this->sampleperiod = sampleperiod;
|
||||||
|
this->downtime = downtime;
|
||||||
|
this->mSenorDesriptions.insert(this->mSenorDesriptions.end(), sensDesc.begin(), sensDesc.end());
|
||||||
|
this->path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
RTSMonFrame::~RTSMonFrame(){}
|
||||||
|
|
||||||
|
int RTSMonFrame::GetId() {
|
||||||
|
return this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RTSMonFrame::SetName(const std::string& name){
|
||||||
|
this->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::string& RTSMonFrame::GetName() {
|
||||||
|
return this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RTSMonFrame::SetSampleRate(int samplerate){
|
||||||
|
this->samplerate = samplerate;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RTSMonFrame::GetSampleRate() {
|
||||||
|
return this->samplerate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RTSMonFrame::SetSamplePeriod(int sampleperiod){
|
||||||
|
this->sampleperiod= sampleperiod;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RTSMonFrame::GetSamplePeriod(){
|
||||||
|
return this->sampleperiod;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RTSMonFrame::SetDownTime(int downtime){
|
||||||
|
this->downtime= downtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int RTSMonFrame::GetDownTime(){
|
||||||
|
return this->downtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool RTSMonFrame::generate([[maybe_unused]] u_int32_t* values){
|
||||||
|
|
||||||
|
|
||||||
|
// Example of the very popular RFC 3339 format UTC time
|
||||||
|
std::stringstream ss;
|
||||||
|
//build path
|
||||||
|
ss << this->path << this->name;
|
||||||
|
std::string monpath = ss.str();
|
||||||
|
boost::filesystem::path directory(monpath.c_str());
|
||||||
|
|
||||||
|
//check for directory
|
||||||
|
if (!boost::filesystem::exists(directory)){
|
||||||
|
boost::filesystem::create_directories(directory);
|
||||||
|
printf("CA7 : created dir %s.\n", monpath.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::time_t time = std::time({});
|
||||||
|
char timeString[std::size("yyyy-mm-ddThh:mm:ssZ")];
|
||||||
|
std::strftime(std::data(timeString), std::size(timeString),"%FT%TZ", std::gmtime(&time));
|
||||||
|
|
||||||
|
ss << "/" << timeString << ".json";
|
||||||
|
std::string filename = ss.str();
|
||||||
|
printf("CA7 : filename %s.\n", filename.c_str());
|
||||||
|
|
||||||
|
auto unix_timestamp = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
|
||||||
|
|
||||||
|
|
||||||
|
//generate header id, name, timestamp,samplerate, sampleperiod, downtime
|
||||||
|
json j;
|
||||||
|
|
||||||
|
j[RTSMONID] = this->id;
|
||||||
|
j[RTSMONNAME] = this->name;
|
||||||
|
j[RTSMONSRATE] = this->samplerate;
|
||||||
|
j[RTSMONSPERIOD] = this->sampleperiod;
|
||||||
|
j[RTSMONDTIME] = this->downtime;
|
||||||
|
j[RTSMONTIMESTAMP] = unix_timestamp;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// write prettified JSON to another file
|
||||||
|
std::ofstream o(filename);
|
||||||
|
o << std::setw(4) << j << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
uint64_t timeSinceEpochMillisec() {
|
||||||
|
using namespace std::chrono;
|
||||||
|
return duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Example of the very popular RFC 3339 format UTC time
|
||||||
|
std::stringstream ss;
|
||||||
|
std::time_t time = std::time({});
|
||||||
|
char timeString[std::size("yyyy-mm-ddThh:mm:ssZ")];
|
||||||
|
std::strftime(std::data(timeString), std::size(timeString),"%FT%TZ", std::gmtime(&time));
|
||||||
|
|
||||||
|
ss << "/home/root/monfiles/" << timeString << ".txt";
|
||||||
|
std::string filename = ss.str();
|
||||||
|
printf("CA7 : filename %s.\n", filename.c_str());
|
||||||
|
|
||||||
|
//save to file
|
||||||
|
std::ofstream outfile (filename,std::ofstream::binary);
|
||||||
|
// if (outfile.write (mByteBuffCpy,this->q_get_data_size.size))
|
||||||
|
// {
|
||||||
|
// printf("CA7 : write file %s succesfully.\n", filename.c_str());
|
||||||
|
// result = std::string("CA7 : write file %s succesfully.\n") + filename;
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// result = std::string("CA7 : file could not be written.\n") + filename;
|
||||||
|
// printf("CA7 : file %s could not be written.\n", filename.c_str());
|
||||||
|
// }
|
||||||
|
outfile.close();
|
||||||
|
printf("CA7 : file %s closed.\n", filename.c_str());
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** old impl */
|
||||||
|
//unsigned char* pData = (unsigned char*) this->mmappedData[i];
|
||||||
|
// save a copy of 1st data
|
||||||
|
//mByteBuffCpy[0] = *pData;
|
||||||
|
|
||||||
|
// printf("CA7 : filename pointer:%p , pno:%d, pcount:%d, dataCount:%d .\n"
|
||||||
|
// , pData
|
||||||
|
// , pData[0].packageNo
|
||||||
|
// , pData[0].packageCount
|
||||||
|
// , pData[0].dataQuantity);
|
||||||
|
|
||||||
|
// printf("CA7 : data[0]:%d , data[1]:%d data[2]:%d \n data[115]:%d , data[116]:%d data[117]:%d.\n"
|
||||||
|
// , pData[0].data[0]
|
||||||
|
// , pData[0].data[1]
|
||||||
|
// , pData[0].data[2]
|
||||||
|
// , pData[0].data[115]
|
||||||
|
// , pData[0].data[116]
|
||||||
|
// , pData[0].data[117]);
|
||||||
|
|
||||||
|
|
||||||
|
// int dlength = 1* (3 + pData->dataQuantity);
|
||||||
|
// pData = (vRCMDeviceData*) (u32Buff + dlength);
|
||||||
|
// printf("CA7 : u32Buff[%p] - pData[%p] - dlength=%d \n", u32Buff , pData, dlength);
|
||||||
|
// printf("CA7 : filename pointer:%p , pno:%d, pcount:%d, dataCount:%d, data[0]:%d , data[1]:%d data[2]:%d , data[3]:%d , data[4]:%d data[5]:%d.\n"
|
||||||
|
// , pData
|
||||||
|
// , pData->packageNo
|
||||||
|
// , pData->packageCount
|
||||||
|
// , pData->dataQuantity
|
||||||
|
// , pData->data[0]
|
||||||
|
// , pData->data[1]
|
||||||
|
// , pData->data[2]
|
||||||
|
// , pData->data[3]
|
||||||
|
// , pData->data[4]
|
||||||
|
// , pData->data[5]);
|
||||||
|
|
||||||
|
|
||||||
|
// Example of the very popular RFC 3339 format UTC time
|
||||||
|
// std::stringstream ss;
|
||||||
|
// std::time_t time = std::time({});
|
||||||
|
// char timeString[std::size("yyyy-mm-ddThh:mm:ssZ")];
|
||||||
|
// std::strftime(std::data(timeString), std::size(timeString),"%FT%TZ", std::gmtime(&time));
|
||||||
|
|
||||||
|
// ss << "/home/root/monfiles/" << timeString << ".txt";
|
||||||
|
// std::string filename = ss.str();
|
||||||
|
// printf("CA7 : filename %s.\n", filename.c_str());
|
||||||
|
|
||||||
|
// //save to file
|
||||||
|
// std::ofstream outfile (filename,std::ofstream::binary);
|
||||||
|
// // if (outfile.write (mByteBuffCpy,this->q_get_data_size.size))
|
||||||
|
// // {
|
||||||
|
// // printf("CA7 : write file %s succesfully.\n", filename.c_str());
|
||||||
|
// // result = std::string("CA7 : write file %s succesfully.\n") + filename;
|
||||||
|
// // }
|
||||||
|
// // else {
|
||||||
|
// // result = std::string("CA7 : file could not be written.\n") + filename;
|
||||||
|
// // printf("CA7 : file %s could not be written.\n", filename.c_str());
|
||||||
|
// // }
|
||||||
|
// outfile.close();
|
||||||
|
//printf("CA7 : file %s closed.\n", filename.c_str());
|
||||||
@@ -1,16 +1,31 @@
|
|||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../include/RTSMonitoringTask.h"
|
#include <RTSMonitoringTask.h>
|
||||||
//#include "../../include/json.hpp"//((
|
|
||||||
//#include "../../include/json_fwd.hpp"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include<iostream>
|
#include<iostream>
|
||||||
|
#include <memory>
|
||||||
#include<cstring>
|
#include<cstring>
|
||||||
|
#include <RTSMonFrame.h>
|
||||||
|
#include<ISensorDesc.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <sstream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <VibSensorDesc.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define RPMSG_SDB_IOCTL_SET_EFD _IOW('R', 0x00, rpmsg_sdb_ioctl_set_efd *)
|
||||||
|
#define RPMSG_SDB_IOCTL_GET_DATA_SIZE _IOWR('R', 0x01, rpmsg_sdb_ioctl_get_data_size *)
|
||||||
|
|
||||||
|
#define DATA_BUF_POOL_SIZE 1024*1024 /* 1MB */
|
||||||
|
#define TIMEOUT 5 * 1000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RTSMonitoringTask::RTSMonitoringTask(/* args */)
|
RTSMonitoringTask::RTSMonitoringTask(/* args */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -24,81 +39,245 @@ RTSMonitoringTask::~RTSMonitoringTask()
|
|||||||
|
|
||||||
bool RTSMonitoringTask::Load() {
|
bool RTSMonitoringTask::Load() {
|
||||||
//later load the file
|
//later load the file
|
||||||
int id = 1;
|
//int id = 1;
|
||||||
RTSMonFrame* rtsMonFrame = new RTSMonFrame(id, "Monitoring1", 3750, 1, 4, "started");
|
|
||||||
rtsMonFrames[id]= rtsMonFrame;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTSMonitoringTask::Init() {
|
bool RTSMonitoringTask::Init() {
|
||||||
|
|
||||||
//load the Monitorings
|
//load the Monitorings
|
||||||
if (this->Load()) {
|
// if (this->Load()) {
|
||||||
printf("CA7 : Monitorings loaded\n");
|
// printf("CA7 : Monitorings loaded\n");
|
||||||
}
|
// }
|
||||||
const std::string fwPath = "home/root/elffile";
|
const std::string fwPath = "home/root/elffile";
|
||||||
const std::string fwName = "zephyr_openamp_rsc_table.elf";
|
const std::string fwName = "zephyr_openamp_rsc_table.elf";
|
||||||
|
|
||||||
//check if the FWIsRunning
|
//check if the FWIsRunning
|
||||||
if (coproHelper.Init(fwPath, fwName) >= 0) {
|
// if (coproHelper.Init(fwPath, fwName) >= 0) {
|
||||||
printf("CA7 : Init success \n");
|
// printf("CA7 : Init success \n");
|
||||||
|
|
||||||
// if (pthread_create( &monThread, NULL, &RTSMonitoringTask::Run, this) == 0) {
|
if (pthread_create( &monThread, NULL, &RTSMonitoringTask::Run, this) == 0) {
|
||||||
// printf("CA7 : virtual_tty_thread creation fails\n");
|
printf("CA7 : mon thread creation fails\n");
|
||||||
// return true;
|
return true;
|
||||||
// }
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
// }
|
||||||
printf("CA7 : starting of Zephyr.elf fails\n");
|
// printf("CA7 : starting of Zephyr.elf fails\n");
|
||||||
return false;
|
// return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RTSMonitoringTask::CreateMonitoring(int id, std::string name, int samplerate, int sampleperiod, int downtime, std::string status){
|
// bool RTSMonitoringTask::CreateMonitoring(int id, std::string name, int samplerate, int sampleperiod, int downtime, std::string status){
|
||||||
this->rtsMonFrames[id] = new RTSMonFrame(id, name, samplerate, sampleperiod, downtime, status);
|
// //this->rtsMonFrames[id] = new RTSMonFrame(id, name, samplerate, sampleperiod, downtime, status);
|
||||||
char * ch = new char[name.length() + 1];
|
// //char * ch = new char[name.length() + 1];
|
||||||
|
|
||||||
// Copying the value of the string into the character array.
|
// // Copying the value of the string into the character array.
|
||||||
strcpy(ch, name.c_str());
|
// //strcpy(ch, name.c_str());
|
||||||
|
|
||||||
this->coproHelper.Copro_writeTtyRpmsg(0,name.length()+1, ch);
|
// //this->coproHelper.Copro_writeTtyRpmsg(0,name.length()+1, ch);
|
||||||
|
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
void* RTSMonitoringTask::Run(void *obj) {
|
void* RTSMonitoringTask::Run(void *obj) {
|
||||||
|
|
||||||
RTSMonitoringTask* rtsMonTask = static_cast<RTSMonitoringTask*>(obj);
|
RTSMonitoringTask* rtsMonTask = static_cast<RTSMonitoringTask*>(obj);
|
||||||
std::string newItem;
|
|
||||||
while (1) {
|
|
||||||
// genrate data
|
|
||||||
int i = 1;
|
|
||||||
newItem = "New Item"; //new std::string("New Item: ").concat(new std::string(i));
|
|
||||||
i++;
|
|
||||||
std::map<int, RTSMonFrame*> rtsMonFrame = rtsMonTask->rtsMonFrames;
|
|
||||||
if (rtsMonFrame.size() > 0) {
|
|
||||||
RTSMonFrame* prtsMonFrame = rtsMonFrame.begin()->second;
|
|
||||||
|
|
||||||
prtsMonFrame->Add(newItem);
|
int fdSdbRpmsg = rtsMonTask->Open("/dev/mon-datafile");
|
||||||
if (i == 200) {
|
if (fdSdbRpmsg > 0) {
|
||||||
//make a dictonary for the rtsMonFrame id, samplerate, sampleperiod, downtime
|
while (rtsMonTask->GetRunState()) {
|
||||||
// boost::python::dict rtsMonFrameDict;
|
rtsMonTask->Read();
|
||||||
// rtsMonFrameDict["id"] = prtsMonFrame->GetId();
|
}
|
||||||
// rtsMonFrameDict["samplerate"] = prtsMonFrame->GetSampleRate();
|
rtsMonTask->Close();
|
||||||
// rtsMonFrameDict["sampleperiod"] = prtsMonFrame->GetSamplePeriod();
|
}
|
||||||
// rtsMonFrameDict["downtime"] = prtsMonFrame->GetDownTime();
|
return 0;
|
||||||
// //make a dictonary for the sampleItems
|
}
|
||||||
// boost::python::list rtsMonItemsList;
|
|
||||||
// auto items = prtsMonFrame->GetItems();
|
|
||||||
// for (auto iter = items.begin(); iter!= items.end(); ++iter)
|
|
||||||
// {
|
|
||||||
// rtsMonItemsList.append(*iter);
|
|
||||||
// }
|
|
||||||
// rtsMonFrameDict["items"]= rtsMonItemsList;
|
|
||||||
// rtsMonTask->callback();
|
|
||||||
|
|
||||||
|
bool RTSMonitoringTask::GetRunState() {
|
||||||
|
return mRunThread;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RTSMonitoringTask::SetRunState(bool runThread) {
|
||||||
|
this->mRunThread.store(runThread) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int RTSMonitoringTask::Open(std::string monfilename){
|
||||||
|
//PyRelinquishGIL scoped;
|
||||||
|
|
||||||
|
this->mFdSdbRpmsg = open(monfilename.c_str(), O_RDWR);
|
||||||
|
|
||||||
|
if (this->mFdSdbRpmsg < 0) {
|
||||||
|
printf("CA7 : Err openening %s, ret=%d\n",monfilename.c_str(), this->mFdSdbRpmsg);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("CA7 : Succes openening %s, ret=%d\n",monfilename.c_str(), this->mFdSdbRpmsg);
|
||||||
|
|
||||||
|
for (int i=0;i<NB_BUF;i++){
|
||||||
|
// Create the evenfd, and sent it to kernel driver, for notification of buffer full
|
||||||
|
this->mefd[i] = eventfd(0, 0);
|
||||||
|
if (this->mefd[i] == -1) {
|
||||||
|
printf("CA7 : failed to get eventfd:%d\n",i);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("CA7 : Forward efd info for buf%d with mFdSdbRpmsg:%d and efd:%d\n",i,this->mFdSdbRpmsg,this->mefd[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->q_set_efd.bufferId = i;
|
||||||
|
this->q_set_efd.eventfd = this->mefd[i];
|
||||||
|
if(ioctl(mFdSdbRpmsg, RPMSG_SDB_IOCTL_SET_EFD, &(this->q_set_efd)) < 0) {
|
||||||
|
printf("CA7 :failed to set efd efd%d-mFdSdbRpmsg%d for :%d\n",i,this->mFdSdbRpmsg,this->mefd[i]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("CA7 : succes to set efd efd%d-mFdSdbRpmsg%d:%d\n",i,this->mFdSdbRpmsg,this->mefd[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// watch eventfd for input
|
||||||
|
this->mfds[i].fd = this->mefd[i];
|
||||||
|
this->mfds[i].events = POLLIN;
|
||||||
|
printf("CA7 : start mapping buffer for efd:%d\n",i);
|
||||||
|
|
||||||
|
mmappedData[i] = mmap(NULL,
|
||||||
|
DATA_BUF_POOL_SIZE,
|
||||||
|
PROT_READ | PROT_WRITE,
|
||||||
|
MAP_PRIVATE,
|
||||||
|
this->mFdSdbRpmsg,
|
||||||
|
0);
|
||||||
|
|
||||||
|
printf("CA7 : DBG mmappedData[%d]:%p\n", i, mmappedData[i]);
|
||||||
|
this->mfMappedData = true;
|
||||||
|
usleep(50000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->mFdSdbRpmsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string RTSMonitoringTask::Read(){
|
||||||
|
//PyRelinquishGIL scoped;
|
||||||
|
|
||||||
|
std::string result;
|
||||||
|
std::list<std::shared_ptr<ISensorDesc>> sensDescs;
|
||||||
|
std::shared_ptr<ISensorDesc> sensorDesc = std::make_shared<VibSensorDesc>();
|
||||||
|
sensDescs.push_back(sensorDesc);
|
||||||
|
|
||||||
|
std::string TEST = "Test";
|
||||||
|
RTSMonFrame frame(0,TEST, 500, 1, 10, sensDescs, "/home/root/monfiles/");
|
||||||
|
|
||||||
|
|
||||||
|
int ret, rc;
|
||||||
|
char buf[16];
|
||||||
|
|
||||||
|
// wait till at least one buffer becomes available
|
||||||
|
//this->mLogs.push_back("CA7 : Start Polling.\n");
|
||||||
|
//printf("CA7 : Start Polling.\n");
|
||||||
|
ret = poll(this->mfds, NB_BUF, TIMEOUT); //ret = poll(fds, NB_BUF, TIMEOUT * 1000);
|
||||||
|
|
||||||
|
if (ret == -1) {
|
||||||
|
perror("poll()");
|
||||||
|
printf("CA7 : Poll Error.\n");
|
||||||
|
return std::string("poll error");
|
||||||
|
}
|
||||||
|
else if (ret == 0){
|
||||||
|
printf("CA7 : No buffer data within %d msec.\n", TIMEOUT);
|
||||||
|
return std::string("CA7 : No buffer data within %d msec.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < NB_BUF; i++)
|
||||||
|
{
|
||||||
|
int revent = this->mfds[i].revents;
|
||||||
|
printf("CA7 : try Reading Buffer %d, reevent=%d, POLLIN=%d.\n", i, revent, POLLIN);
|
||||||
|
if (this->mfds[i].revents & POLLIN) {
|
||||||
|
printf("CA7 : Start Reading Buffer %d.\n", i );
|
||||||
|
rc = read(this->mefd[i], buf, 16);
|
||||||
|
if (!rc) {
|
||||||
|
return std::string("CA7: stdin closed - Buffer:%d\n", i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get buffer data size*/
|
||||||
|
this->q_get_data_size.bufferId = i;
|
||||||
|
|
||||||
|
if(ioctl(this->mFdSdbRpmsg, RPMSG_SDB_IOCTL_GET_DATA_SIZE, &(this->q_get_data_size)) < 0) {
|
||||||
|
printf("CA7 : Failed to get data size.\n");
|
||||||
|
return std::string("Failed to get data size\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->q_get_data_size.size) {
|
||||||
|
printf("CA7 : call generate frame - datasize:%d.\n", this->q_get_data_size.size);
|
||||||
|
mNbUncompMB++;
|
||||||
|
mNbUncompData += this->q_get_data_size.size;
|
||||||
|
|
||||||
|
//vRCMDeviceData* pData = (vRCMDeviceData*) this->mmappedData[i];
|
||||||
|
u_int32_t* u32Buff = (u_int32_t*) this->mmappedData[i];
|
||||||
|
frame.generate(u32Buff);
|
||||||
|
this->mfds[i].revents = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RTSMonitoringTask::Close(){
|
||||||
|
//PyRelinquishGIL scoped;
|
||||||
|
|
||||||
|
printf("CA7 : close of device \n");
|
||||||
|
|
||||||
|
if (this->mfMappedData) {
|
||||||
|
for (int i=0;i<NB_BUF;i++){
|
||||||
|
int rc = munmap(mmappedData[i], DATA_BUF_POOL_SIZE);
|
||||||
|
if (rc != 0) {
|
||||||
|
printf("CA7 : Buffer could not be unmapped\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->mfMappedData = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int res = close(this->mFdSdbRpmsg);
|
||||||
|
if (res != 0) {
|
||||||
|
printf("CA7 : close of device failed: %s\n", strerror(errno));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("CA7 : close of device done\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// void* RTSMonitoringTask::Run(void *obj) {
|
||||||
|
|
||||||
|
// RTSMonitoringTask* rtsMonTask = static_cast<RTSMonitoringTask*>(obj);
|
||||||
|
// std::string newItem;
|
||||||
|
// while (1) {
|
||||||
|
// // genrate data
|
||||||
|
// int i = 1;
|
||||||
|
// newItem = "New Item"; //new std::string("New Item: ").concat(new std::string(i));
|
||||||
|
// i++;
|
||||||
|
// std::map<int, RTSMonFrame*> rtsMonFrame = rtsMonTask->rtsMonFrames;
|
||||||
|
// if (rtsMonFrame.size() > 0) {
|
||||||
|
// RTSMonFrame* prtsMonFrame = rtsMonFrame.begin()->second;
|
||||||
|
|
||||||
|
// prtsMonFrame->Add(newItem);
|
||||||
|
// if (i == 200) {
|
||||||
|
// //make a dictonary for the rtsMonFrame id, samplerate, sampleperiod, downtime
|
||||||
|
// // boost::python::dict rtsMonFrameDict;
|
||||||
|
// // rtsMonFrameDict["id"] = prtsMonFrame->GetId();
|
||||||
|
// // rtsMonFrameDict["samplerate"] = prtsMonFrame->GetSampleRate();
|
||||||
|
// // rtsMonFrameDict["sampleperiod"] = prtsMonFrame->GetSamplePeriod();
|
||||||
|
// // rtsMonFrameDict["downtime"] = prtsMonFrame->GetDownTime();
|
||||||
|
// // //make a dictonary for the sampleItems
|
||||||
|
// // boost::python::list rtsMonItemsList;
|
||||||
|
// // auto items = prtsMonFrame->GetItems();
|
||||||
|
// // for (auto iter = items.begin(); iter!= items.end(); ++iter)
|
||||||
|
// // {
|
||||||
|
// // rtsMonItemsList.append(*iter);
|
||||||
|
// // }
|
||||||
|
// // rtsMonFrameDict["items"]= rtsMonItemsList;
|
||||||
|
// // rtsMonTask->callback();
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
#include <VibChannelDesc.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VibChannelDesc::VibChannelDesc(u_int32_t id, const std::string& name, VALUEFORMAT valueFormat, u_int32_t vByteSpace){
|
||||||
|
this->id = id;
|
||||||
|
this->name = name;
|
||||||
|
this->valueFormat = valueFormat;
|
||||||
|
this->vByteSpace = vByteSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
u_int32_t VibChannelDesc::GetId(){
|
||||||
|
return this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::string& VibChannelDesc::GetName(){
|
||||||
|
return this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VALUEFORMAT VibChannelDesc::GetValueFormat(){
|
||||||
|
return this->valueFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return the length of the data that is neeeded for one value of the channel in UINT32
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
u_int32_t VibChannelDesc::GetValueByteSpace(){
|
||||||
|
return this->vByteSpace;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <VibSensorDesc.h>
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VibSensorDesc::VibSensorDesc(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int VibSensorDesc::GetDescription(){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VibSensorDesc::Add2Json(json& j){
|
||||||
|
|
||||||
|
j["VibSen1"] = "1";
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -56,9 +56,9 @@ int RTSCoproHelper::Init(std::string fwPath, std::string fwName) {
|
|||||||
if (this->Copro_isFwRunning() != 0){
|
if (this->Copro_isFwRunning() != 0){
|
||||||
//copro is already Runnibng nothing TODO
|
//copro is already Runnibng nothing TODO
|
||||||
//res = this->Copro_openTtyRpmsg(CMDCHANNEL, 0);
|
//res = this->Copro_openTtyRpmsg(CMDCHANNEL, 0);
|
||||||
this->Copro_stopFw();
|
//this->Copro_stopFw();
|
||||||
//return res;
|
//return res;
|
||||||
//return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//load Firmware
|
//load Firmware
|
||||||
|
|||||||
@@ -17,20 +17,32 @@ SRC_URI += " \
|
|||||||
file://zephyr_openamp_rsc_table.elf \
|
file://zephyr_openamp_rsc_table.elf \
|
||||||
file://src/RTService.cpp \
|
file://src/RTService.cpp \
|
||||||
file://src/monitoringTask/RTSMonitoringTask.cpp \
|
file://src/monitoringTask/RTSMonitoringTask.cpp \
|
||||||
|
file://src/monitoringTask/RTSMonFrame.cpp \
|
||||||
file://src/utilities/RTSCoproHelper.cpp \
|
file://src/utilities/RTSCoproHelper.cpp \
|
||||||
file://include/RTSCoproHelper.h \
|
file://include/RTSCoproHelper.h \
|
||||||
file://include/RTSMonFrame.h \
|
file://include/RTSMonFrame.h \
|
||||||
file://include/RTSMonitoringTask.h \
|
file://include/RTSMonitoringTask.h \
|
||||||
|
file://include/ISensorDesc.h \
|
||||||
|
file://include/IChannelDesc.h \
|
||||||
|
file://include/VibSensorDesc.h \
|
||||||
|
file://include/json.hpp \
|
||||||
|
file://src/monitoringTask/VibSensorDesc.cpp \
|
||||||
|
file://include/VibChannelDesc.h \
|
||||||
|
file://src/monitoringTask/VibChannelDesc.cpp \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
S = "${WORKDIR}"
|
S = "${WORKDIR}"
|
||||||
|
DESTINATION = "/usr/bin"
|
||||||
# ELFDESTINATION = "~/elffile"
|
# ELFDESTINATION = "~/elffile"
|
||||||
|
|
||||||
|
|
||||||
# FILES:${PN} += "${DESTINATION}"
|
FILES:${PN} += "${DESTINATION}"
|
||||||
|
|
||||||
|
do_install () {
|
||||||
|
install -d ${D}${DESTINATION}
|
||||||
|
install -m 0644 ${B}/RTService ${D}/${DESTINATION}/
|
||||||
|
}
|
||||||
# do_install () {
|
# do_install () {
|
||||||
# install -d ${D}${ELFDESTINATION}
|
# install -d ${D}${ELFDESTINATION}
|
||||||
# install -m 0644 ${WORKDIR}/*.elf ${D}/${ELFDESTINATION}
|
# install -m 0644 ${WORKDIR}/*.elf ${D}/${ELFDESTINATION}
|
||||||
@@ -38,7 +50,7 @@ S = "${WORKDIR}"
|
|||||||
#}
|
#}
|
||||||
|
|
||||||
# RDEPENDS:${PN} += " perl"
|
# RDEPENDS:${PN} += " perl"
|
||||||
# RDEPENDS:${PN} += " boost"
|
RDEPENDS:${PN} += " boost"
|
||||||
|
|
||||||
BBCLASSEXTEND = "native "
|
BBCLASSEXTEND = "native "
|
||||||
# BBCLASSEXTEND = "native nativesdk"
|
# BBCLASSEXTEND = "native nativesdk"
|
||||||
|
|||||||
Reference in New Issue
Block a user