public void Update()
    {
        m_pressingState.SetNewValue(IsEmittorActive(), out hasPressingStateChanged);
        AddTimeToCounters();

        if (IsWritingMorse())
        {
            SetAsListeningNextKey();
            if (HasFinishedToPressKey())
            {
                MorseKey newMorseKey = GetPreviousKeyDetected();
                AddNewMorseKey(newMorseKey);
                NotifyMorseInProgress(newMorseKey);
            }
            if (hasPressingStateChanged)
            {
                NotifyChangeInPressingState();
            }
        }
        else
        {
            if (HasMorseKeyDetected())
            {
                NotifyMorseDetected();
            }
            if (IsListeningNextKey())
            {
                ResetMorseDetection();
            }
        }
    }
    private void NotifyMorseInProgress(MorseKey newMorseKey)
    {
        MorseValueWithOrigine morseLinked = GetCurrentMorseValueWithOrigine();

        m_onMorseKeyDetected.Invoke(newMorseKey, morseLinked);
        m_onMorseChanged.Invoke(morseLinked);
    }
    private static     MorseKey[] ConvertCharsToKeys(char[] keys)
    {
        MorseKey[] finalkeys = new MorseKey[keys.Length];
        for (int i = 0; i < keys.Length; i++)
        {
            finalkeys[i] = (keys[i] == LONG) ? MorseKey.Long : MorseKey.Short;
        }

        return(finalkeys);
    }
 private void DisplayMorseInChange(MorseKey key, MorseValueWithOrigine morse)
 {
     DisplayMorseFound(morse);
 }
 private void AddNewMorseKey(MorseKey newMorseKey)
 {
     m_detectedKeys.Add(newMorseKey);
 }