Exemplo n.º 1
0
        private static List <byte> GetAnalyticsByteArrayForControl(Control theControl, DeviceID theID)
        {
            List <byte> byteArray = new List <byte> ();

            byteArray.Add(HeepLanguage.AnalyticsData);
            HeepLanguage.AddDeviceIDToMemory(byteArray, theID);

            List <byte> timeArray = GetMillisecondsByteArray();

            byte numBytes = (byte)(timeArray.Count + 5);

            byteArray.Add(numBytes);
            byteArray.Add((byte)theControl.GetID());
            byteArray.Add(1);              // Only support 1 byte control values with this right now
            byteArray.Add((byte)theControl.GetCurValue());
            byteArray.Add(1);              // Unity is only running on absolute time for the moment
            byteArray.Add((byte)timeArray.Count);

            for (int i = 0; i < timeArray.Count; i++)
            {
                byteArray.Add(timeArray [timeArray.Count - i - 1]);
            }

            string printableString = "";

            for (int i = 0; i < byteArray.Count; i++)
            {
                printableString += byteArray [i];
                printableString += " ";
            }

            Debug.Log(printableString);

            return(byteArray);
        }
Exemplo n.º 2
0
        private static List <byte> AddErrorMessageToBuffer(String message, HeepDevice theDevice)
        {
            List <byte> outputBuf = new List <byte>();

            outputBuf.Add(HeepLanguage.ErrorOpCode);
            HeepLanguage.AddDeviceIDToMemory(outputBuf, theDevice.GetDeviceID());

            byte stringLength = (byte)message.Length;

            outputBuf.Add(stringLength);

            for (int i = 0; i < message.Length; i++)
            {
                outputBuf.Add((byte)message [i]);
            }

            return(outputBuf);
        }
Exemplo n.º 3
0
        private static List <byte> GetAnalyticsByteArrayForBufferControl(BufferControl theControl, DeviceID theID)
        {
            List <byte> byteArray = new List <byte> ();

            byteArray.Add(HeepLanguage.AnalyticsData);
            HeepLanguage.AddDeviceIDToMemory(byteArray, theID);

            byte bytesToRecord = theControl.GetBuffer().Count > 10 ? (byte)10 : (byte)theControl.GetBuffer().Count;

            List <byte> timeArray = GetMillisecondsByteArray();

            byte numBytes = (byte)(timeArray.Count + bytesToRecord + 4);

            byteArray.Add(numBytes);
            byteArray.Add((byte)theControl.GetID());

            byteArray.Add(bytesToRecord);

            for (int i = 0; i < bytesToRecord; i++)
            {
                byteArray.Add(theControl.GetBuffer() [i]);
            }

            byteArray.Add(1);              // Unity is only running on absolute time for the moment
            byteArray.Add((byte)timeArray.Count);

            for (int i = 0; i < timeArray.Count; i++)
            {
                byteArray.Add(timeArray [timeArray.Count - i - 1]);
            }

            string printableString = "";

            for (int i = 0; i < byteArray.Count; i++)
            {
                printableString += byteArray [i];
                printableString += " ";
            }

            Debug.Log(printableString);

            return(byteArray);
        }