changeset 43:87d88bc28ac0

bug servey
author riono <e165729@ie.u-ryukyu.ac.jp>
date Sun, 19 Sep 2021 18:03:04 +0900
parents ce46626dddb1
children 132f56edd10c
files Test/Example/RemoteTake/CreateRemoteTakeTest.cs Test/Example/RemoteTake/RTCommand.cs Test/Example/RemoteTake/StartRemoteTake.cs daemon/Connection.cs datagear/RemoteDataGearManager.cs datagear/dg/MessagePackDataGear.cs
diffstat 6 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Test/Example/RemoteTake/CreateRemoteTakeTest.cs	Sun Sep 19 17:04:08 2021 +0900
+++ b/Test/Example/RemoteTake/CreateRemoteTakeTest.cs	Sun Sep 19 18:03:04 2021 +0900
@@ -4,7 +4,7 @@
 
 namespace Christie_net.Test.Example.RemoteTake {
 public class CreateRemoteTakeTest : CodeGear {
-    [Take] public string command;
+    [Take] public RTCommand command;
 
 
     public override void Run(CodeGearManager cgm) {
--- a/Test/Example/RemoteTake/RTCommand.cs	Sun Sep 19 17:04:08 2021 +0900
+++ b/Test/Example/RemoteTake/RTCommand.cs	Sun Sep 19 18:03:04 2021 +0900
@@ -7,19 +7,19 @@
     [Key("line")]
     public string line;
     [Key("command")]
-    public string cmd;
+    public string command;
     [Key("offset")]
     public int offset;
-
-    public RTCommand(string line, string cmd, int i) {
+    
+    public RTCommand(string line, string command, int offset) {
         this.line = line;
-        this.cmd = cmd;
-        this.offset = i;
+        this.command = command;
+        this.offset = offset;
     }
 
     public override string ToString() {
         return "RTCommand{ line=" + line + "\\" +
-               ", cmd=" + cmd + "\\" + ", offset=" + offset + "}";
+               ", cmd=" + command + "\\" + ", offset=" + offset + "}";
     }
 }
 }
\ No newline at end of file
--- a/Test/Example/RemoteTake/StartRemoteTake.cs	Sun Sep 19 17:04:08 2021 +0900
+++ b/Test/Example/RemoteTake/StartRemoteTake.cs	Sun Sep 19 18:03:04 2021 +0900
@@ -11,7 +11,7 @@
         cgm.Setup(new FinishRemoteTake());
         RTCommand cmd = new RTCommand("insert", "line", 0);
         
-        cgm.GetDGM("remote").Put("command", "test");
+        cgm.GetDGM("remote").Put("command", cmd);
     }
     
 }
--- a/daemon/Connection.cs	Sun Sep 19 17:04:08 2021 +0900
+++ b/daemon/Connection.cs	Sun Sep 19 18:03:04 2021 +0900
@@ -5,6 +5,7 @@
 using System.Net.Sockets;
 using Christie_net.codegear;
 using Christie_net.datagear.command;
+using Christie_net.Test.Example.RemoteTake;
 
 namespace Christie_net.daemon {
 public class Connection {
@@ -53,7 +54,8 @@
     /// <param name="cmd"></param>
     public void Write(Command cmd) {
         // Debug
-        Console.WriteLine("length:" + cmd.dg.GetData());
+        RTCommand rtcmd = (RTCommand)cmd.dg.GetData();
+        Console.WriteLine("length:" + rtcmd.line);
         
         byte[] buffer = cmd.Convert();
 
--- a/datagear/RemoteDataGearManager.cs	Sun Sep 19 17:04:08 2021 +0900
+++ b/datagear/RemoteDataGearManager.cs	Sun Sep 19 18:03:04 2021 +0900
@@ -8,6 +8,7 @@
 using Christie_net.daemon;
 using Christie_net.datagear.command;
 using Christie_net.datagear.dg;
+using Christie_net.Test.Example.RemoteTake;
 
 namespace Christie_net.datagear {
 public class RemoteDataGearManager : DataGearManager {
@@ -73,7 +74,8 @@
        
         // Debug
         Console.WriteLine("connect:" + connection);
-        Console.WriteLine("data:" + data);
+        RTCommand cmd = (RTCommand) data;
+        Console.WriteLine("data:" + cmd.command);
         
         connection.Write(cm);
     }
--- a/datagear/dg/MessagePackDataGear.cs	Sun Sep 19 17:04:08 2021 +0900
+++ b/datagear/dg/MessagePackDataGear.cs	Sun Sep 19 18:03:04 2021 +0900
@@ -43,6 +43,7 @@
                 try {
                     var dataObj = MessagePackSerializer.Deserialize<T>(messagePack);
                     ///var dataCast = Convert.ChangeType(dataObj, clazz);
+                    Console.WriteLine("MSP data: " + dataObj);
                     SetData(dataObj);
                 } catch (Exception e) {
                     Console.WriteLine(e.StackTrace);