private DEVICE_SIGNATURE getDeviceInfo(UInt32 rawDeviceSignature)
        {
            DEVICE_SIGNATURE identifiedDevice = new DEVICE_SIGNATURE();

            return(identifiedDevice);
        }
        public void helloProcessing()
        {
            // 1. Try handshake ("@@@") three times; or continue if successful.
            // 2. Check if reply seems valid(ish).
            // 3. Chop up the reply into useful device data.
            // 4. Save the device data for later.
            // 5. If not reply, let the user know it was a fail.

            int[] firmwareDatePieces = { 0x00, 0x00 };
            int   firmwareStatus     = 0x00;

            int[] signatureBytes  = { 0x00, 0x00, 0x00 };
            int   pagesizeInWords = 0x00;

            int[] freeFlash  = { 0x00, 0x00 };
            int[] eepromSize = { 0x00, 0x00 };

            serialPorts.WriteData("AT+PIOB0");
            Thread.Sleep(120);
            serialPorts.WriteData("AT+PIOB1");
            Thread.Sleep(120);


            for (int i = 0; i < 3; i++)
            {
                serialPorts.WriteData("@@@");
                Thread.Sleep(50);
                rxBuffer = serialPorts.ReadExistingAsString();
                if (rxBuffer.Length > 0)
                {
                    break;
                }
            }

            // ATtiny have all lower case, ATMega have upper case.  Not sure if it's expected.
            if (rxBuffer.Contains("tsb") || rxBuffer.Contains("TSB") && rxBuffer.Length == 17)
            {
                if (rxBuffer.Length > 16)
                {
                    firmwareDatePieces[0] = rxBuffer[3];
                    firmwareDatePieces[1] = rxBuffer[4];
                    firmwareStatus        = rxBuffer[5];
                    signatureBytes[0]     = rxBuffer[6];
                    signatureBytes[1]     = rxBuffer[7];
                    signatureBytes[2]     = rxBuffer[8];
                    pagesizeInWords       = rxBuffer[9];
                    freeFlash[0]          = rxBuffer[10];
                    freeFlash[1]          = rxBuffer[11];
                    eepromSize[0]         = rxBuffer[12];
                    eepromSize[1]         = rxBuffer[13];
                }

                // Date of firmware.
                int day   = firmwareDatePieces[0];
                int month = ((firmwareDatePieces[1] & 0xF0) >> 1);
                int year  = (firmwareDatePieces[1] & 0x0F);

                firmwareDateString = (month + " " + day + " " + "20" + year);

                // Atmel device signature.
                deviceSignature = signatureBytes[0].ToString("X2") + " " + signatureBytes[1].ToString("X2") + " " + signatureBytes[2].ToString("X2");
                Int32 combinedDeviceSignature = (Int32)(((signatureBytes[0] << 16) | signatureBytes[1] << 8) | signatureBytes[2]);
                deviceSignatureValue = (DEVICE_SIGNATURE)combinedDeviceSignature;

                // The size is in words, make it bytes.
                pageSize = (pagesizeInWords * 2);
                string pageSizeString = (pagesizeInWords * 2).ToString();

                // Get flash size.
                flashSize = ((freeFlash[1] << 8) | freeFlash[0]) * 2;
                string flashLeft = flashSize.ToString();

                // REPLACE WITH DEVICE INFO
                numberOfPages = flashSize / pageSize;
                //numberOfPages = 16;

                // Get EEPROM size.
                fullEepromSize = ((eepromSize[1] << 8) | eepromSize[0]) + 1;
                string eeprom = fullEepromSize.ToString();

                mainDisplay.AppendText(
                    deviceSignatureValue.ToString()
                    + "\nFirmware Date:  " + firmwareDateString
                    + "\nStatus:         " + firmwareStatus.ToString("X2")
                    + "\nSignature:      " + deviceSignature
                    + "\nPage Size:      " + pageSizeString
                    + "\nFlash Free:     " + flashLeft
                    + "\nEEPROM size:    " + eeprom + "\n",
                    System.Drawing.Color.White);

                commandInProgress = commands.none;
                setTsbConnectionSafely(true);
            }
            else
            {
                mainDisplay.AppendText("Could not handshake with TSB. Please reset and try again.\n", System.Drawing.Color.Crimson);
            }
        }