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);
        }
Beispiel #2
0
        public List <byte> GetControlBufferByID(int ID)
        {
            for (int i = 0; i < controls.Count; i++)
            {
                if (controls [i].GetID() == ID)
                {
                    if (controls [i].GetType().Equals(typeof(BufferControl)))
                    {
                        BufferControl myCtrlPtr = (BufferControl)controls [i];
                        return(myCtrlPtr.GetBuffer());
                    }
                    else
                    {
                        //Debug.Log ("Control is Incorrect Type");
                        return(new List <byte>());
                    }
                }
            }

            return(new List <byte>());
        }