private static void NotifySessionChanged(SubFunction subFunction)
            {
                SessionChangedEventArgs args = new SessionChangedEventArgs();

                args.DefaultSession = (subFunction == SubFunction.DefaultSession);
                DcmService.FireSessionChangedEvent(args);
            }
Exemplo n.º 2
0
        private void NotifyParsingDataIncommingEvent(
            List <KeyValuePair <string, string> > parsedList,
            DcmAppRxIndicationArgs args, bool postiveRes)
        {
            ParsingDataIncommingEventArgs parsingArgs = new ParsingDataIncommingEventArgs();

            parsingArgs.EntryList       = parsedList;
            parsingArgs.ResponseData    = args.ResponseData;
            parsingArgs.RequestData     = args.RequestData;
            parsingArgs.PostiveResponse = postiveRes;
            parsingArgs.RequestCanId    = args.RequestCanId;
            parsingArgs.ResponseCanId   = args.ResponseCanId;
            DcmService.FireParsingDataIncommingEvent(parsingArgs);
        }
Exemplo n.º 3
0
        private void NotifyRawDataIncomming(bool ok,
                                            RawDataIncommingEventArgs.OperationEum operation, Message message)
        {
            RawDataIncommingEventArgs args = new RawDataIncommingEventArgs();

            args.Ok        = ok;
            args.CanId     = message.Id;
            args.Operation = operation;

            args.Data = new List <byte>();
            for (int i = 0; i < message.DataLen; i++)
            {
                args.Data.Add(message.Data[i]);
            }

            DcmService.FireRawDataIncommingEvent(args);
        }
Exemplo n.º 4
0
        // 此方法需要以指定周期调用
        private void Dispatch()
        {
#if DEBUG_DISPATCH_PERIOD
            Console.WriteLine("Elapsed: {0}", stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();
#endif
            lock (syncDispatchRoot)
            {
                if (dcmTp.IsIdle)
                {
                    currentEntity = queue.Dequeue();
                }

                if (currentEntity != null)
                {
                    canTickStopWatch.Stop();
                    if (dcmTp.Execute(currentEntity.CanId, DcmService.ResponseId,
                                      currentEntity.Data))
                    {
                        currentEntity = null;
                        canTickStopWatch.Restart();
                    }
                }
                else
                {
                    if (CanTickEnable && DcmService.CanIsOpened() &&
                        canTickStopWatch.ElapsedMilliseconds >= CanTickPeriod)
                    {
                        canTickStopWatch.Restart();

                        if (SuppressResponse)
                        {
                            queue.Enqueue(BeatWithoutRespEntity);
                        }
                        else
                        {
                            queue.Enqueue(BeatWithRespEntity);
                        }
                    }
                }
            }
        }