コード例 #1
0
        public Form1()
        {
            InitializeComponent();

            DataPack testPack = new DataPack(100, 1234567890, 2000, 3415, 24, 142);

            DataPack.PrintHex(testPack.ToByteArray(), "Test data pack");
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Byte.TryParse(textBox2.Text, out deviceID);
            //DateTime timestamp = DateTime.ParseExact(textBox3.Text,"yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
            Int64.TryParse(textBox3.Text, out timestamp);
            Int32.TryParse(textBox4.Text, out x);
            Int32.TryParse(textBox5.Text, out y);
            Int32.TryParse(textBox6.Text, out z);
            Int32.TryParse(textBox1.Text, out velocity);
            //Byte.TryParse(textBox7.Text, out data);
            String dataString = textBox7.Text;
            byte[] data = System.Text.Encoding.Default.GetBytes(dataString);

            //DataPack dataPack = new DataPack(length, deviceID, timestamp, x, y, z);

            byte[] buffer = new DataPack(deviceID, timestamp, x, y, z, velocity, data).ToByteArray();
            client.send(buffer);
        }