]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/reply.cpp
Forgot to add the new files
[r2c2.git] / source / libmarklin / reply.cpp
index 5a02df212897c4efd36a2261d4747d94da41617b..1d7d536ba1dbb506c94289e23499b138bba44f86 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of the MSP Märklin suite
-Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
+Copyright © 2006-200 Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */
 
@@ -108,6 +108,45 @@ Reply Reply::read(int fd, Cmd cmd)
        return result;
 }
 
+Reply Reply::simulate(Cmd cmd)
+{
+       Reply result;
+
+       if(cmd==CMD_STATUS)
+       {
+               result.data[0] = 0x80;
+               result.len = 1;
+       }
+       if(cmd==CMD_EVENT)
+               result.len = 1;
+       else if(cmd==CMD_TURNOUT)
+               ;
+       else if(cmd==CMD_TURNOUT_STATUS)
+       {
+               result.data[0] = 0x04;
+               result.len = 1;
+       }
+       else if(cmd==CMD_LOK)
+               ;
+       else if(cmd==CMD_LOK_STATUS)
+       {
+               result.data[1] = 0x20;
+               result.len = 3;
+       }
+       else if(cmd==CMD_SENSOR_PARAM_SET)
+               ;
+       else if(cmd==CMD_SENSOR_REPORT)
+               ;
+       else if(cmd==CMD_POWER_ON)
+               ;
+       else if(cmd==CMD_POWER_OFF)
+               ;
+       else
+               result.err = ERR_SYS_ERROR;
+
+       return result;
+}
+
 ostream &operator<<(ostream &out, const Reply &reply)
 {
        out<<reply.err;