• Hatte mal eine Testklasse dafür, hab sie leider wohl irgentwann gelöscht.
  • Code unten sollte theoretisch funktionieren, ist allerdings noch ungetestet (kann ins FESA Wiki, wenn getestet)
  • Wichtig: Immer einen neuen timeStamp_ für jeden neuen context nehmen, sonst wird in der RTAction immer auf den gleichen slot geschrieben.
  • Der slot wird, soweit ich mich richtig erinnere nur durch den cycleName_ bestimmt.

#ifndef CUSTOM_CONTEXT_H_
#define CUSTOM_CONTEXT_H_

#include <SAFTd.h>
#include <TimingReceiver.h>
#include <fesa-core/Synchronization/MultiplexingContext.h>

class CustomContext : fesa::MultiplexingContext
{
    // Not sure yet what to be sync flag is used for .. seems not to hurt to set it
    static const uint8_t accessMask = fesa::MultiplexingContext::SET_ALLOWED | fesa::MultiplexingContext::CHECK_FLAG_TO_BE_SYNC;

    public:
        CustomContext(std::string name): MultiplexingContext()
        {
                // E.g. "FAIR.SELECTOR.S=12" for sequence-multiplexing
                // E.g. "FAIR.SELECTOR.P=34" for process-multiplexing
                this->cycleName_ = name;

                // Can be: NoneCtxt, TimerCtxt, CycleOccurrenceCtxt, CycleTypeCtxt
                // use CycleOccurrenceCtxt for acquisition fields (and for "get" on setting fields ? )
                // use CycleTypeCtxt for muxed setting fields when accessed on the server side
                this->type_ = MuxContextType::CycleTypeCtxt;

                // FIXME: This part should only be done only once, and only for CycleOccurrenceCtxt
                std::map<Glib::ustring, Glib::ustring> timingDevices = saftlib::SAFTd_Proxy::create()->getDevices();
                // Create a proxy object in this process that has access to the remote object stored inside the saftd daemon.
                Glib::RefPtr<saftlib::TimingReceiver_Proxy> timingReceiver = saftlib::TimingReceiver_Proxy::create(timingDevices.begin()->second);

                // Important! Using the same stamp repeadetly will overwrite the same slot when CycleOccurrenceCtxt is used ( even if cycleID is different )
                // So required to create a new stamp for each context
                this->timeStamp_ = timingReceiver->ReadCurrentTime();

                // Can be SetAction, GetAction, RTAction, GetNotifiedAction, SpecificInitAction
                this->actionType_ = fesa::MultiplexingContext::RTAction;

                this->acquisitionAccessMask_ = accessMask;
        }
};

#endif // CUSTOM_CONTEXT_H_
Topic revision: r1 - 10 Aug 2018, AlexanderSchwinn
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback