C_runtime/PLCObject.hpp
author Edouard Tisserant <edouard@beremiz.fr>
Fri, 06 Dec 2024 12:16:07 +0100
changeset 4062 1994928ce3d2
parent 4032 1ffff67678ad
permissions -rw-r--r--
py_ext: fix CSV update happening only once.
3937
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     1
/*
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
    Copyright Edouard TISSERANT 2024
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
    See COPYING for details
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     4
*/
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     5
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     6
#if !defined(_PLCObject_hpp_)
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
#define _PLCObject_hpp_
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
     9
#include <map>
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    10
#include <vector>
3945
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
    11
#include <mutex>
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
    12
#include <thread>
3949
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    13
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    14
#include "blob.hpp"
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    15
3937
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    16
#include "erpc_PLCObject_interface.hpp"
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    17
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    18
using namespace erpcShim;
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    19
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    20
#define FOR_EACH_PLC_SYMBOLS_DO(ACTION) \
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    21
    ACTION(PLC_ID)\
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    22
    ACTION(startPLC)\
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    23
    ACTION(stopPLC)\
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    24
    ACTION(ResetDebugVariables)\
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    25
    ACTION(RegisterDebugVariable)\
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    26
    ACTION(FreeDebugData)\
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    27
    ACTION(GetDebugData)\
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    28
    ACTION(suspendDebug)\
3949
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    29
    ACTION(resumeDebug)\
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    30
    ACTION(ResetLogCount)\
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    31
    ACTION(GetLogCount)\
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    32
    ACTION(LogMessage)\
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    33
    ACTION(GetLogMessage)
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    34
3949
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    35
extern "C" {   
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    36
    typedef struct s_PLCSyms{
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    37
        uint8_t *PLC_ID;
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    38
        int (*startPLC)(int argc,char **argv);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    39
        int (*stopPLC)(void);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    40
        void (*ResetDebugVariables)(void);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    41
        int (*RegisterDebugVariable)(unsigned int idx, void* force, size_t force_size);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    42
        void (*FreeDebugData)(void);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    43
        int (*GetDebugData)(unsigned int *tick, unsigned int *size, void **buffer);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    44
        int (*suspendDebug)(int disable);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    45
        void (*resumeDebug)(void);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    46
        void (*ResetLogCount)(void);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    47
        uint32_t (*GetLogCount)(uint8_t level);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    48
        int (*LogMessage)(uint8_t level, char* buf, uint32_t size);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    49
        uint32_t (*GetLogMessage)(uint8_t level, uint32_t msgidx, char* buf, uint32_t max_size, uint32_t* tick, uint32_t* tv_sec, uint32_t* tv_nsec);
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    50
    } PLCSyms;
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
    51
}
3937
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    52
class PLCObject : public BeremizPLCObjectService_interface
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    53
{
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    54
    public:
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    55
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    56
        PLCObject(void);
3937
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    57
        ~PLCObject(void);
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    58
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    59
        // ERPC interface
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    60
        uint32_t AppendChunkToBlob(const binary_t * data, const binary_t * blobID, binary_t * newBlobID);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    61
        uint32_t GetLogMessage(uint8_t level, uint32_t msgID, log_message * message);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    62
        uint32_t GetPLCID(PSKID * plcID);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    63
        uint32_t GetPLCstatus(PLCstatus * status);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    64
        uint32_t GetTraceVariables(uint32_t debugToken, TraceVariables * traces);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    65
        uint32_t MatchMD5(const char * MD5, bool * match);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    66
        uint32_t NewPLC(const char * md5sum, const binary_t * plcObjectBlobID, const list_extra_file_1_t * extrafiles, bool * success);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    67
        uint32_t PurgeBlobs(void);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    68
        uint32_t RepairPLC(void);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    69
        uint32_t ResetLogCount(void);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    70
        uint32_t SeedBlob(const binary_t * seed, binary_t * blobID);
3945
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
    71
        uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken);
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    72
        uint32_t StartPLC(void);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    73
        uint32_t StopPLC(bool * success);
4032
1ffff67678ad Add ExtendedCall to PLCObject as a replacement of RemoteExec and reflect it in eRPC interface.
Edouard Tisserant <edouard@beremiz.fr>
parents: 3977
diff changeset
    74
        uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer);
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    75
3977
2b0f8c4c8d02 C runtime: Fix PLCObject.hpp preventing build.
etisserant <edouard.tisserant@gmail.com>
parents: 3961
diff changeset
    76
        // Public interface used by runtime
2b0f8c4c8d02 C runtime: Fix PLCObject.hpp preventing build.
etisserant <edouard.tisserant@gmail.com>
parents: 3961
diff changeset
    77
        uint32_t AutoLoad();
2b0f8c4c8d02 C runtime: Fix PLCObject.hpp preventing build.
etisserant <edouard.tisserant@gmail.com>
parents: 3961
diff changeset
    78
        uint32_t LogMessage(uint8_t level, std::string message);
2b0f8c4c8d02 C runtime: Fix PLCObject.hpp preventing build.
etisserant <edouard.tisserant@gmail.com>
parents: 3961
diff changeset
    79
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    80
    private:
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    81
        // A map of all the blobs
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    82
        std::map<std::vector<uint8_t>, Blob*> m_mapBlobIDToBlob;
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    83
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    84
        // PLC object library handle
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    85
        void * m_handle;
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    86
3945
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
    87
        // Shared object mutex
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
    88
        std::mutex m_PLClibMutex;
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
    89
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    90
        // Symbols resolved from the PLC object
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    91
        PLCSyms m_PLCSyms;
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    92
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    93
        // argc and argv for the PLC object
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    94
        int m_argc;
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    95
        char ** m_argv;
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    96
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    97
        // PLC status
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    98
        PLCstatus m_status;
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
    99
3949
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
   100
        // PSK
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
   101
        std::string m_PSK_ID;
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
   102
        std::string m_PSK_secret;
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
   103
3945
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   104
        // Debug token, used for consistency check of traces
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   105
        uint32_t m_debugToken;
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   106
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   107
        // Trace thread
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   108
        std::thread m_traceThread;
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   109
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   110
        // Trace thread mutex
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   111
        std::mutex m_tracesMutex;
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   112
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   113
        // Trace double buffer
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   114
        std::vector<trace_sample> m_traces;
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   115
3940
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
   116
        uint32_t BlobAsFile(const binary_t * BlobID, std::filesystem::path filename);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
   117
        uint32_t LoadPLC(void);
934bd46a7500 C++ runtime: WIP: untested PLCObject implementation. Still missing tracing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3937
diff changeset
   118
        uint32_t UnLoadPLC(void);
3945
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   119
        uint32_t PurgePLC(void);
3949
f64dce4e2f62 C runtime: initial fixes. Now runs and traces first_steps example.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3945
diff changeset
   120
        void PurgeTraceBuffer(void);
3945
d303aab8f68b C++ runtime: WIP. Continue PLCObject implementation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3940
diff changeset
   121
        void TraceThreadProc(void);
3937
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   122
};
e13543d716b6 C++ runtime: add eRPC server, minimal CLI and Makefile. WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   123
3977
2b0f8c4c8d02 C runtime: Fix PLCObject.hpp preventing build.
etisserant <edouard.tisserant@gmail.com>
parents: 3961
diff changeset
   124
#endif