00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <OPENR/OSyslog.h>
00013 #include <OPENR/OPENRAPI.h>
00014 #include "RobotDesign.h"
00015 #include "entry.h"
00016
00017 RobotDesign::RobotDesign()
00018 {
00019 }
00020
00021 OStatus
00022 RobotDesign::DoInit(const OSystemEvent& event)
00023 {
00024 OSYSDEBUG(("RobotDesign::DoInit()\n"));
00025 return oSUCCESS;
00026 }
00027
00028 OStatus
00029 RobotDesign::DoStart(const OSystemEvent& event)
00030 {
00031 OSYSDEBUG(("RobotDesign::DoStart()\n"));
00032
00033 OStatus result;
00034 char design[orobotdesignNAME_MAX+1];
00035 ODesignDataID dataID;
00036 byte* addr;
00037 size_t size = 0;
00038
00039 result = OPENR::GetRobotDesign(design);
00040 if (result != oSUCCESS) {
00041 OSYSLOG1((osyslogERROR, "%s : %s %d",
00042 "RobotDesign::DoStart()",
00043 "OPENR::GetRobotDesign() FAILED", result));
00044 return oFAIL;
00045 }
00046
00047 OSYSPRINT(("OPENR::GetRobotDesign() : %s\n", design));
00048
00049 result= OPENR::FindDesignData("SAMPLE_DATA", &dataID, &addr, &size);
00050 if (result != oSUCCESS) {
00051 OSYSLOG1((osyslogERROR, "%s : %s %d",
00052 "RobotDesign::DoStart()",
00053 "OPENR::FindDesignData() FAILED", result));
00054 return oFAIL;
00055 }
00056
00057 memcpy(design, addr, size);
00058 design[size] = '\0';
00059 OSYSPRINT(("%s", design));
00060
00061 result= OPENR::DeleteDesignData(dataID);
00062 if (result != oSUCCESS) {
00063 OSYSLOG1((osyslogERROR, "%s : %s %d",
00064 "RobotDesign::DoStart()",
00065 "OPENR::DeleteDesignData() FAILED", result));
00066 return oFAIL;
00067 }
00068
00069 return oSUCCESS;
00070 }
00071
00072 OStatus
00073 RobotDesign::DoStop(const OSystemEvent& event)
00074 {
00075 OSYSDEBUG(("RobotDesign::DoStop()\n"));
00076 return oSUCCESS;
00077 }
00078
00079 OStatus
00080 RobotDesign::DoDestroy(const OSystemEvent& event)
00081 {
00082 return oSUCCESS;
00083 }