Пример #1
0
        public bool openDevice()
        {
            bool opened = true;

            CastInfoEvent("Open called in Trionic7", ActivityType.ConvertingFile);
            MM_BeginPeriod(1);

            if (canUsbDevice is LPCCANDevice && m_UseFlasherOnDevice)
            {
                // connect to adapter
                LPCCANDevice lpc = (LPCCANDevice)canUsbDevice;

                if (lpc.connect())
                {
                    // get flasher object
                    flash = lpc.createFlasher();
                    logger.Debug("T7CombiFlasher object created");
                    CastInfoEvent("CombiAdapter ready", ActivityType.ConvertingFile);
                }
                else
                {
                    opened = false;
                }
            }
            else
            {
                if (kwpHandler.openDevice())
                {
                    CastInfoEvent("Canbus channel opened", ActivityType.ConvertingFile);

                    if (kwpHandler.startSession())
                    {
                        CastInfoEvent("Session started", ActivityType.ConvertingFile);
                    }
                    else
                    {
                        CastInfoEvent("Unable to start session. Wait for previous session to timeout (10 seconds) and try again!", ActivityType.ConvertingFile);
                        kwpHandler.closeDevice();
                        opened = false;
                    }
                }
                else
                {
                    CastInfoEvent("Unable to open canbus channel", ActivityType.ConvertingFile);
                    kwpHandler.closeDevice();
                    opened = false;
                }
            }

            if (!opened)
            {
                CastInfoEvent("Open failed in Trionic7", ActivityType.ConvertingFile);
                if (canUsbDevice != null)
                {
                    canUsbDevice.close();
                }
                MM_EndPeriod(1);
            }
            return(opened);
        }
Пример #2
0
 public EducationalBodiesController(ApplicationDbContext context, IFlasher f,
                                    IHostingEnvironment ihostingEnvironment)
 {
     _context             = context;
     _ihostingEnvironment = ihostingEnvironment;
     _f = f;
 }
Пример #3
0
 public UsersController(ApplicationDbContext context, IFlasher f,
                        IMapper mapper, UserManager <AppUser> userManager)
 {
     _context     = context;
     _mapper      = mapper;
     _userManager = userManager;
     _f           = f;
 }
Пример #4
0
 public CartController(IFlasher flasher, IHttpContextAccessor httpContextAccessor,
                       ApplicationDbContext dbContext, UserManager <User> userManager)
 {
     _flasher             = flasher;
     _httpContextAccessor = httpContextAccessor;
     _dbContext           = dbContext;
     _userManager         = userManager;
 }
Пример #5
0
        private void setFlasher()
        {
            KWPHandler.setKWPDevice(kwpDevice);
            kwpHandler = KWPHandler.getInstance();

            T7Flasher.setKWPHandler(kwpHandler);
            flash = new T7Flasher();
            flash.onStatusChanged += flash_onStatusChanged;
        }
Пример #6
0
 public CabinetController(ApplicationDbContext db, UserManager <User> userManager, IFlasher flasher,
                          TeamSpeakQueryClient teamspeakQueryClient, ILogger <CabinetController> logger,
                          IMapper mapper)
 {
     _db                   = db;
     _userManager          = userManager;
     _flasher              = flasher;
     _teamspeakQueryClient = teamspeakQueryClient;
     _logger               = logger;
     _mapper               = mapper;
 }
Пример #7
0
        /// <summary>
        /// Cleans up connections and resources
        /// </summary>
        override public void Cleanup()
        {
            try
            {
                MM_EndPeriod(1);
                logger.Debug("Cleanup called in Trionic7");
                if (flash != null)
                {
                    flash.onStatusChanged -= flash_onStatusChanged;
                    flash.stopFlasher();
                    flash.cleanup();
                    flash = null;
                }
                if (kwpHandler != null)
                {
                    kwpHandler.EnableLog = false;
                    kwpHandler.closeDevice();
                }
                if (canUsbDevice != null)
                {
                    if (canUsbDevice is LPCCANDevice)
                    {
                        LPCCANDevice lpc = (LPCCANDevice)canUsbDevice;
                        lpc.disconnect();
                        canUsbDevice.close();
                        canUsbDevice = null;
                        logger.Debug("Closed LPCCANDevice in Trionic7");
                    }
                    else
                    {
                        canUsbDevice.close();
                        canUsbDevice = null;
                    }
                }
            }
            catch (Exception e)
            {
                logger.Debug(e.Message);
            }

            LogManager.Flush();
        }
 public TsserverBelongsToCurrentUserFilter(ApplicationDbContext db, UserManager <User> userManager, IFlasher flasher)
 {
     this.db          = db;
     this.userManager = userManager;
     this.flasher     = flasher;
 }
Пример #9
0
 public SchedulingTripHeadsController(ApplicationDbContext context, IFlasher f)
 {
     _context = context;
     _f       = f;
 }
Пример #10
0
 public static void Secondary(this IFlasher flasher, string message, bool dismissable = false)
 {
     flasher.Flash(Types.Secondary, message, dismissable);
 }
Пример #11
0
 public static void Dark(this IFlasher flasher, string message, bool dismissable = false)
 {
     flasher.Flash(Types.Dark, message, dismissable);
 }
Пример #12
0
 public static void Light(this IFlasher flasher, string message, bool dismissable = false)
 {
     flasher.Flash(Types.Light, message, dismissable);
 }
Пример #13
0
 public HomeController(IFlasher f)
 {
     this.f = f;
 }
 public RegisterController(ApplicationDbContext db, IFlasher flasher)
 {
     _db      = db;
     _flasher = flasher;
 }
Пример #15
0
 public PatientController(ApplicationDbContext db, IFlasher flasher)
 {
     _db      = db;
     _flasher = flasher;
 }
Пример #16
0
 public HomeController(IFlasher flasher, ILogger <HomeController> logger)
 {
     _flasher = flasher;
     _logger  = logger;
 }
Пример #17
0
 public static void Success(this IFlasher flasher, string message, bool dismissable = false)
 {
     flasher.Flash(Types.Success, message, dismissable);
 }
Пример #18
0
 public static void Warning(this IFlasher flasher, string message, bool dismissable = false)
 {
     flasher.Flash(Types.Warning, message, dismissable);
 }
Пример #19
0
 public CitiesController(ApplicationDbContext context, IFlasher f)
 {
     _context = context;
     _f       = f;
 }
 public ProductController(ApplicationDbContext dbContext, IFlasher flasher)
 {
     _dbContext = dbContext;
     _flasher   = flasher;
 }