Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AWFELStatusResponse.cs « FelLib - github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a3d9ef595ccdb815268f247a53bd8f8c28947ed9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace com.clusterrr.FelLib
{
    public class AWFELStatusResponse
    {
        public UInt16 Mark = 0xFFFF;
        public UInt16 Tag = 0;
        public byte State;

        public AWFELStatusResponse()
        {
        }

        public AWFELStatusResponse(byte[] data)
        {
            Mark = (UInt16)(data[0] | (data[1] * 0x100));
            Tag = (UInt16)(data[2] | (data[3] * 0x100));
            State = data[4];
        }

        public byte[] Data
        {
            get
            {
                var data = new byte[8];
                data[0] = (byte)(Mark & 0xFF); // mark
                data[1] = (byte)((Mark >> 8) & 0xFF); // mark
                data[2] = (byte)(Tag & 0xFF); // tag
                data[3] = (byte)((Tag >> 8) & 0xFF); // tag
                data[4] = State;
                return data;
            }
        }
    }
}