Пример #1
0
 public UDP_PACKETS_ENCODER(UDP_PACKETS_ENCODER udppm, byte bytedata)
 {
     this.Ldata = udppm.Ldata;
     byte[] add_data = new byte[1];
     add_data[0] = bytedata;
     ByteDataAdditioner(add_data);
 }
Пример #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="remoteIPaddress"></param>
        /// <param name="remotePort"></param>
        /// <param name="senderPort"></param>
        /// <param name="recieverPort"></param>
        public SENDER(string remoteIPaddress, int remotePort, int senderPort, int recieverPort)
        {
            UPE = new UDP_PACKETS_ENCODER();

            UPS = new UDP_PACKETS_SENDER(remoteIPaddress,remotePort,senderPort);
            UPR = new UDP_PACKETS_RECIEVER(recieverPort);
        }
Пример #3
0
 public RECIEVER(int remotePort, int senderPort, int recieverPort)
 {
     UPE = new UDP_PACKETS_ENCODER();
     CLIENT = new UDP_PACKETS_CLIANT.UDP_PACKETS_CLIANT(recieverPort);
     this.senderPort = senderPort;
     this.remotePort = remotePort;
 }
Пример #4
0
 public UDP_PACKETS_ENCODER(UDP_PACKETS_ENCODER udppm, string str, Encoding encoding)
 {
     this.Ldata = udppm.Ldata;
     byte[] add_data = encoding.GetBytes(str);
     byte[] _add_data = BitConverter.GetBytes(add_data.Length);
     ByteDataAdditioner(_add_data);
     ByteDataAdditioner(add_data);
 }
Пример #5
0
 public UDP_PACKETS_ENCODER(UDP_PACKETS_ENCODER udppm, byte[] add_data)
 {
     this.Ldata = udppm.Ldata;
     for (int t = 0; t < add_data.Length; t++)
     {
         this.Ldata.Add(add_data[t]);
     }
 }
Пример #6
0
 public UDP_PACKETS_ENCODER(UDP_PACKETS_ENCODER udppm, string str, Encoding encoding)
 {
     this.Ldata = udppm.Ldata;
     byte[] add_data  = encoding.GetBytes(str);
     byte[] _add_data = BitConverter.GetBytes(add_data.Length);
     ByteDataAdditioner(_add_data);
     ByteDataAdditioner(add_data);
 }
Пример #7
0
 public UDP_PACKETS_ENCODER(UDP_PACKETS_ENCODER udppm, byte[] add_data)
 {
     this.Ldata = udppm.Ldata;
     for (int t = 0; t < add_data.Length; t++)
     {
         this.Ldata.Add(add_data[t]);
     }
 }
Пример #8
0
        public bool Connect(bool[] data, int width, int height, int stride)
        {
            //sendblock
            UPE = new UDP_PACKETS_ENCODER();
            UPE += (int)(data.Length / SendSize + 1);//1フレームに送信するパケット数 キネクトの深度データで大凡10パケット
            UPE += SendSize;//分割したサイズ
            UPE += data.Length;
            UPE += width;
            UPE += height;
            UPE += stride;
            UPS.Send(UPE.data);

            isconnected = true;
            return true;
        }
Пример #9
0
        public void Connect()
        {
            byte[] data = CLIENT.Recieve();

            UPD = new UDP_PACKETS_DECODER(data);
            nPackets = UPD.get_int();
            recieveSize = UPD.get_int();
            data_length = UPD.get_int();
            width = UPD.get_int();
            height = UPD.get_int();
            stride = UPD.get_int();

            UPE=new UDP_PACKETS_ENCODER();
            UPE+=(int)0;
            CLIENT.Send(UPE.data);
            isconnected = true;
        }
Пример #10
0
    void SendData()
    {
        try
        {
            this.List_SendHuman.Clear();
            this.List_SendHuman = this.generator.List_Humans;
            //this.List_SendHuman.Add(this.generator.robotBone);

            UDP_PACKETS_CODER.UDP_PACKETS_ENCODER enc = new UDP_PACKETS_CODER.UDP_PACKETS_ENCODER();

            enc += (byte)6;
            enc += (byte)this.generator.List_Humans.Count;

            for (int i = 0; i < this.generator.List_Humans.Count; i++)
            {
                enc += (byte)this.List_SendHuman[i].numofBone;

                for (int j = 0; j < this.List_SendHuman[i].numofBone; j++)
                {

                    enc += this.List_SendHuman[i].bones[j].dimensiton;
                    enc += this.List_SendHuman[i].bones[j].position.x;
                    enc += this.List_SendHuman[i].bones[j].position.y;
                    enc += this.List_SendHuman[i].bones[j].position.z;

                    enc += this.List_SendHuman[i].bones[j].quaternion.x;
                    enc += this.List_SendHuman[i].bones[j].quaternion.y;
                    enc += this.List_SendHuman[i].bones[j].quaternion.z;
                    enc += this.List_SendHuman[i].bones[j].quaternion.w;

                    enc += this.List_SendHuman[i].bones[j].IsTracking;
                }
            }
        }
        catch
        {
            Debug.Log("Error:SendData");
        }
        

        
    }
Пример #11
0
    void SendData()
    {
        try
        {
            this.List_SendHuman.Clear();
            this.List_SendHuman = this.generator.List_Humans;
            //this.List_SendHuman.Add(this.generator.robotBone);

            UDP_PACKETS_CODER.UDP_PACKETS_ENCODER enc = new UDP_PACKETS_CODER.UDP_PACKETS_ENCODER();

            enc += (byte)6;
            enc += (byte)this.generator.List_Humans.Count;

            for (int i = 0; i < this.generator.List_Humans.Count; i++)
            {
                enc += (byte)this.List_SendHuman[i].numofBone;

                for (int j = 0; j < this.List_SendHuman[i].numofBone; j++)
                {
                    enc += this.List_SendHuman[i].bones[j].dimensiton;
                    enc += this.List_SendHuman[i].bones[j].position.x;
                    enc += this.List_SendHuman[i].bones[j].position.y;
                    enc += this.List_SendHuman[i].bones[j].position.z;

                    enc += this.List_SendHuman[i].bones[j].quaternion.x;
                    enc += this.List_SendHuman[i].bones[j].quaternion.y;
                    enc += this.List_SendHuman[i].bones[j].quaternion.z;
                    enc += this.List_SendHuman[i].bones[j].quaternion.w;

                    enc += this.List_SendHuman[i].bones[j].IsTracking;
                }
            }
        }
        catch
        {
            Debug.Log("Error:SendData");
        }
    }
Пример #12
0
    void SendData()
    {
        try
        {
            this.robotPos = this.robot.transform.position;
            UDP_PACKETS_CODER.UDP_PACKETS_ENCODER enc = new UDP_PACKETS_CODER.UDP_PACKETS_ENCODER();
            enc += this.robotPos.x;
            enc += this.robotPos.y;
            enc += this.robotPos.z;
            enc += this.robotLightPos.x;
            enc += this.robotLightPos.y;
            enc += this.robotLightPos.z;
            this.data = enc.data;
            this.client.Update(ref this.data);
            Debug.Log("Send");

        }
        catch
        {
            Debug.Log("Error:ReceiveData");

        }
    }
Пример #13
0
 public UDP_PACKETS_ENCODER(UDP_PACKETS_ENCODER udppm, bool booldata)
 {
     this.Ldata = udppm.Ldata;
     byte[] add_data = BitConverter.GetBytes(booldata);
     ByteDataAdditioner(add_data);
 }
Пример #14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="id"></param>
        public void Send(byte[] data,int id)
        {
            if (isconnected == true)
            {
                int i = 0;
                for (i = 0; i < (int)(data.Length / SendSize); i++)
                {
                    byte[] _data = new byte[SendSize];
                    Array.Copy(data, i * SendSize, _data, 0, SendSize);
                    //sendblock
                    UPE = new UDP_PACKETS_ENCODER();
                    UPE += id;
                    UPE += i;
                    UPE += _data;
                    UPS.Send(UPE.data);
                }

                byte[] __data = new byte[data.Length % SendSize];
                Array.Copy(data, ((int)(data.Length / SendSize)-1) * SendSize, __data, 0, data.Length % SendSize);
                //sendblock
                UPE = new UDP_PACKETS_ENCODER();
                UPE += id;
                UPE += i;
                UPE += __data;
                UPS.Send(UPE.data);

            }
            else
            {
                throw new Exception("error from UDP_STREAMING, connect before to send.");
            }
        }
Пример #15
0
 public UDP_PACKETS_ENCODER(UDP_PACKETS_ENCODER udppm)
 {
     this.Ldata = udppm.Ldata;
 }
Пример #16
0
 public UDP_PACKETS_ENCODER(UDP_PACKETS_ENCODER udppm, byte bytedata)
 {
     this.Ldata = udppm.Ldata;
     byte[] add_data = new byte[1];
     add_data[0] = bytedata;
     ByteDataAdditioner(add_data);
 }
Пример #17
0
 public UDP_PACKETS_ENCODER(UDP_PACKETS_ENCODER udppm, sbyte sbytedata)
 {
     this.Ldata = udppm.Ldata;
     byte[] add_data = BitConverter.GetBytes(sbytedata);
     ByteDataAdditioner(add_data);
 }
Пример #18
0
 public UDP_PACKETS_ENCODER(UDP_PACKETS_ENCODER udppm)
 {
     this.Ldata = udppm.Ldata;
 }