00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <string.h>
00013 #include <OPENR/OSyslog.h>
00014 #include <OPENR/core_macro.h>
00015 #include "SampleSubject.h"
00016
00017 SampleSubject::SampleSubject()
00018 {
00019 }
00020
00021 OStatus
00022 SampleSubject::DoInit(const OSystemEvent& event)
00023 {
00024 NEW_ALL_SUBJECT_AND_OBSERVER;
00025 REGISTER_ALL_ENTRY;
00026 SET_ALL_READY_AND_NOTIFY_ENTRY;
00027 return oSUCCESS;
00028 }
00029
00030 OStatus
00031 SampleSubject::DoStart(const OSystemEvent& event)
00032 {
00033 ENABLE_ALL_SUBJECT;
00034 ASSERT_READY_TO_ALL_OBSERVER;
00035 return oSUCCESS;
00036 }
00037
00038 OStatus
00039 SampleSubject::DoStop(const OSystemEvent& event)
00040 {
00041 DISABLE_ALL_SUBJECT;
00042 DEASSERT_READY_TO_ALL_OBSERVER;
00043 return oSUCCESS;
00044 }
00045
00046 OStatus
00047 SampleSubject::DoDestroy(const OSystemEvent& event)
00048 {
00049 DELETE_ALL_SUBJECT_AND_OBSERVER;
00050 return oSUCCESS;
00051 }
00052
00053 void
00054 SampleSubject::Ready(const OReadyEvent& event)
00055 {
00056 OSYSPRINT(("SampleSubject1::Ready() : %s\n",
00057 event.IsAssert() ? "ASSERT READY" : "DEASSERT READY"));
00058
00059 char str[32];
00060 strcpy(str, "!!! Hello world !!!");
00061 subject[sbjSendString]->SetData(str, sizeof(str));
00062 subject[sbjSendString]->NotifyObservers();
00063 }