using System.Collections.Generic;
using System.Net.Mail;
using System.Text;

namespace InABox.DigitalMatter
{

    public class DMGuppyBluetoothTag : DMBluetoothTag
    {
        public uint SerialNumber { get; set; }

        public sbyte TxPower { get; set; }

        public byte BatteryVoltage { get; set; }

        public sbyte InternalTemperature { get; set; }

        public override string ID()
        {
            return SerialNumber.ToString();
        }

        public override string Type()
        {
            return "Guppy";
        }

        protected override void DoDecode(IDMReadBuffer buffer)
        {
            SerialNumber = buffer.TakeUInt32();
            TxPower = buffer.TakeInt8();
            BatteryVoltage = buffer.TakeByte();
            InternalTemperature = buffer.TakeInt8();
        }

        protected override void DoEncode(IDMWriteBuffer buffer)
        {
            buffer.AddUInt32(SerialNumber);
            buffer.AddInt8(TxPower);
            buffer.AddByte(BatteryVoltage);
            buffer.AddInt8(InternalTemperature);
        }
    }
}
