fsfw-from-zero/ws-objects/objects-solutions/main-02.cpp

25 lines
660 B
C++
Raw Normal View History

2022-10-04 11:09:29 +02:00
#include "fsfw/objectmanager.h"
#include <iostream>
#include <iomanip>
using namespace std;
class MySystemObject: public SystemObject {
public:
MySystemObject(): SystemObject(0x10101010) {}
ReturnValue_t initialize() override {
cout << "MySystemObject::initialize: Custom init" << endl;
2022-10-04 11:20:21 +02:00
return returnvalue::OK;
2022-10-04 11:09:29 +02:00
}
};
int main() {
new MySystemObject();
auto* objManager = ObjectManager::instance();
objManager->initialize();
auto* mySysObj = objManager->get<MySystemObject>(0x10101010);
cout << "Object ID: " << setfill('0') << hex << "0x" << setw(8) <<
mySysObj->getObjectId() << endl;
return 0;
}