Exemple #1
0
        async void HideInformationFrame(object sender, System.EventArgs e)
        {
            OpaqueContainer.FadeTo(0, 250);
            InformationFrame.TranslateTo(200, 0, 250, Easing.CubicIn);
            InformationFrame.RotateYTo(90, 250, Easing.CubicIn);
            await InformationFrame.FadeTo(0, 250);

            InformationFrame.IsVisible = false;
            OpaqueContainer.IsVisible  = false;
        }
Exemple #2
0
        async Task ShowInformationFrame()
        {
            if (InformationFrame.IsVisible)
            {
                return;
            }

            InformationFrame.IsVisible = true;
            OpaqueContainer.IsVisible  = true;
            InformationFrame.RotateYTo(-90, 0);
            await InformationFrame.TranslateTo(-200, 0, 0);

            OpaqueContainer.FadeTo(0.5, 250);
            InformationFrame.FadeTo(1, 250);
            InformationFrame.RotateYTo(0, 250, Easing.CubicOut);
            await InformationFrame.TranslateTo(0, 0, 250, Easing.CubicOut);
        }
Exemple #3
0
            //
            // Decode the received frame
            //
            Boolean Decode(out String packetFrame)
            {
                Int32         ptr    = 0;
                Boolean       retVal = false;
                StringBuilder s      = new StringBuilder("|", 4096);

                try
                {
                    //
                    //  Catch any exceptions during decode
                    //
                    ptr = staLink.destinationStation.Decode(inBuf, ptr);
                    ptr = staLink.sourceStation.Decode(inBuf, ptr);

                    s.Append("|" + staLink.sourceStation.stationIDString + "|ch=" + staLink.sourceStation.chBit.ToString());
                    s.Append("|" + staLink.destinationStation.stationIDString + "|ch=" + staLink.destinationStation.chBit.ToString());

                    if (staLink.sourceStation.extBit == 0)
                    {
                        ptr = staLink.relayStation1.Decode(inBuf, ptr);
                        s.Append("|" + staLink.relayStation1.stationIDString + "|ch=" + staLink.relayStation1.chBit.ToString());
                        if (staLink.relayStation1.extBit == 0)
                        {
                            ptr = staLink.relayStation2.Decode(inBuf, ptr);
                            s.Append("|" + staLink.relayStation2.stationIDString + "|ch=" + staLink.relayStation2.chBit.ToString());
                            if (staLink.relayStation2.extBit == 0)
                            {
                                StationAddress tmpR = new StationAddress();
                                s.Append("|r??:(");

                                do
                                {
                                    ptr = tmpR.Decode(inBuf, ptr);
                                    s.Append("\\" + tmpR.stationIDString + ":ch=" + tmpR.chBit.ToString());
                                } while (tmpR.extBit == 0);
                                s.Append(")");
                                //throw new Exception("Too many relay addresses");
                            }
                            else
                            {
                                s.Append("|");
                            }
                        }
                        else
                        {
                            s.Append("||");
                        }
                    }
                    else
                    {
                        s.Append("|||");
                    }
                    cmdOctetPtr = ptr;

                    if ((staLink.destinationStation.chBit == staLink.sourceStation.chBit))
                    {
                        //
                        // Old protocol version
                        //
                        version = ProtocolVersion.V20;
                    }
                    else
                    {
                        //
                        // New protocol version
                        //
                        version = ProtocolVersion.V22;
                    }

                    if (staLink.destinationStation.chBit == 0)
                    {
                        //
                        // Response type
                        //
                        cmdResp = PacketType.Response;
                    }
                    else
                    {
                        //
                        // Command type
                        //
                        cmdResp = PacketType.Command;
                    }

                    //
                    // Get frame type.  I and S frame must be decoded later after we know whether we
                    // are using mod8 or mod128 sequence numbers.
                    //
                    Byte   tmp = inBuf[ptr];
                    String t   = "";

                    pfBit = (tmp >> 4) & 0x01;      //ToDo  change needed to support SABME

                    seqNumMode = SequenceNumberMode.Mod8;

                    //Frame.InformationFrame.Decode(this, rawBuf, ptr, out t);

                    if ((tmp & 0x01) == I)
                    {
                        //
                        // I frame
                        //
                        frameClass = FrameClasses.IClass;
                        frameType  = FrameTypes.IType;
                        ptr        = InformationFrame.Decode(this, inBuf, ptr, out t);
                    }

                    if ((tmp & 0x03) == S)
                    {
                        //
                        // S frame
                        //
                        frameClass = FrameClasses.SClass;
                        frameType  = (FrameTypes)(tmp & 0x0f);
                        ptr        = SupervisoryFrame.Decode(this, inBuf, ptr, out t);
                    }

                    if ((tmp & 0x03) == U)
                    {
                        //
                        // U frame.  We can decode uFrames right away
                        //
                        frameClass = FrameClasses.UClass;
                        frameType  = (FrameTypes)(tmp & 0xef);
                        ptr        = UnnumberedFrame.Decode(this, inBuf, ptr, out t);
                    }
                    s.Append("|" + version.ToString() + "|" + frameType.ToString() + "|" + cmdResp.ToString() + "|pf=" + pfBit.ToString());

                    if (t.Length > 0)
                    {
                        s.Append(t);
                    }
                    s.Append(Support.DumpRawFrame(rawBuf));

                    retVal = true;
                }
                catch (Exception ex)
                {
                    s.Append(ex.Message + CRLF);
                    Support.DbgPrint("Exception during frame decode:" + ex.Message + CRLF);
                    retVal = false;
                }
                finally
                {
                    s.Append("]");
                    packetFrame = s.ToString();
                }

                return(retVal);
            }