RobotDesign.cc

Go to the documentation of this file.
00001 //
00002 // Copyright 2002,2004 Sony Corporation 
00003 //
00004 // Permission to use, copy, modify, and redistribute this software for
00005 // non-commercial use is hereby granted.
00006 //
00007 // This software is provided "as is" without warranty of any kind,
00008 // either expressed or implied, including but not limited to the
00009 // implied warranties of fitness for a particular purpose.
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 }

Generated on Sun Dec 2 23:04:30 2007 for openSDK by  doxygen 1.3.9.1