changeset 14:277dd59bf1e2

add RemoteMessage
author riono <e165729@ie.u-ryukyu.ac.jp>
date Sat, 21 Nov 2020 02:03:24 +0900
parents e4b46d4ef79c
children 49521c7269bc
files datagear/RemoteMessage.cs datagear/command/Command.cs datagear/command/CommandBuilder.cs
diffstat 3 files changed, 34 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datagear/RemoteMessage.cs	Sat Nov 21 02:03:24 2020 +0900
@@ -0,0 +1,25 @@
+using System.Net.Sockets;
+using MessagePack;
+
+namespace Christie_net.datagear {
+[MessagePackObject]
+public class RemoteMessage {
+    [Key("type")]
+    public int type; // コマンドタイプ
+    [Key("fromDmgName")]
+    public string fromDmgName; // 送り元のDgmName REPLYの時に使用
+    [Key("key")]
+    public string key;
+    [Key("clazz")]
+    public string clazz;
+    
+    public RemoteMessage(){} // for messagePack
+
+    public RemoteMessage(int type, string fromDmgName, string key, string clazz) {
+        this.type = type;
+        this.fromDmgName = fromDmgName;
+        this.key = key;
+        this.clazz = clazz;
+    }
+}
+}
\ No newline at end of file
--- a/datagear/command/Command.cs	Thu Nov 19 23:52:29 2020 +0900
+++ b/datagear/command/Command.cs	Sat Nov 21 02:03:24 2020 +0900
@@ -1,6 +1,7 @@
 using System;
 using System.IO;
 using Christie_net.codegear;
+using Christie_net.daemon;
 using Christie_net.datagear.dg;
 
 namespace Christie_net.datagear.command {
@@ -13,7 +14,7 @@
     public CodeGear cg; // for localtake
     public DataGear<object> dg; // for put/localtake/reply
     public Type clazz; // for remote
-    //public Connection connection = null; // for reply
+    public Connection connection = null; // for reply
 
     public Command(CommandBuilder cb) {
         this.type = cb.type;
@@ -24,7 +25,7 @@
         this.cg = cb.cg;
         this.dg = cb.dg;
         this.clazz = cb.clazz;
-        //this.connection = cb.connection;
+        this.connection = cb.connection;
     }
 
     // instead of any Constoractor args
@@ -44,10 +45,9 @@
     }
 
     public override string ToString() {
-        // return "Command : type = " + type.commandType + ", key = " + key + "toDgmName = " + toDgmName +
-        //        " fromDgmName = " + fromDgmName + " cgmID = " + cgmID + " cg = " + cg + " dg = " + dg + " clazz = " +
-        //        clazz + "connection = " + connection;
-        return null;
+        return "Command : type = " + type.commandType + ", key = " + key + "toDgmName = " + toDgmName +
+               " fromDgmName = " + fromDgmName + " cgmID = " + cgmID + " cg = " + cg + " dg = " + dg + " clazz = " +
+               clazz + "connection = " + connection;
     }
 }
 }
\ No newline at end of file
--- a/datagear/command/CommandBuilder.cs	Thu Nov 19 23:52:29 2020 +0900
+++ b/datagear/command/CommandBuilder.cs	Sat Nov 21 02:03:24 2020 +0900
@@ -1,5 +1,6 @@
 using System;
 using Christie_net.codegear;
+using Christie_net.daemon;
 using Christie_net.datagear.dg;
 
 namespace Christie_net.datagear.command {
@@ -12,7 +13,7 @@
     protected internal CodeGear cg = null; // for localtake
     protected internal DataGear<object> dg = null; // for put/localtake/reply
     protected internal Type clazz = null; // for remote
-    //protected internal Connection connection = null; // for reply
+    protected internal Connection connection = null; // for reply
     
     //private CommandFactory factory = new CommandFactory();
 
@@ -25,7 +26,7 @@
         this.cg = null;
         this.dg = null;
         this.clazz = null;
-        //this.connection = null;
+        this.connection = null;
         return this;
     }