Пример #1
0
        public void AddDeserializeQueue(char singlechar)
        {
            switch (index)
            {
            case 0:
                if (singlechar != '{')
                {
                    index = -1;
                    packetvalue.Clear();

                    if (singlechar == '[')
                    {
                        OnParsedSOP?.Invoke();
                    }

                    else if (singlechar == ']')
                    {
                        OnParsedEOP?.Invoke();
                    }

                    else if (int.TryParse(packetvalue.ToString(), out outvalue))
                    {
                        OnParsedError?.Invoke(packettype, outvalue);
                    }
                }

                break;

            case 1:
                if ('a' <= singlechar && singlechar <= 'z')
                {
                    packettype = singlechar;
                }
                else
                {
                    index = -1;
                    packetvalue.Clear();

                    if (int.TryParse(packetvalue.ToString(), out outvalue))
                    {
                        OnParsedError?.Invoke(packettype, outvalue);
                    }
                }

                break;

            default:
                if ('0' <= singlechar && singlechar <= '9')
                {
                    packetvalue.Append(singlechar);
                }
                else
                {
                    if (singlechar == '}')
                    {
                        if (int.TryParse(packetvalue.ToString(), out outvalue))
                        {
                            OnParsed?.Invoke(packettype, outvalue);
                        }
                    }
                    else
                    {
                        if (int.TryParse(packetvalue.ToString(), out outvalue))
                        {
                            OnParsedError?.Invoke(packettype, outvalue);
                        }
                    }
                    index = -1;
                    packetvalue.Clear();
                }

                break;
            }

            index++;
        }
Пример #2
0
 public void Parsed(ZpiObject zpiObject)
 {
     OnParsed?.Invoke(this, zpiObject);
 }
Пример #3
0
 public void Parsed(ZclCommand zclCommand)
 {
     OnParsed?.Invoke(this, zclCommand);
 }