Exemplo n.º 1
0
 private bool GetApplicationChannel(int appChIdx, ref UInt64 chMask, ref int chIdx)
 {
     XLDefine.XL_Status status = driver.XL_GetApplConfig(applicationName, (uint)appChIdx, ref hwType, ref hardwareIndex, ref hardwareChannel, XLDefine.XL_BusTypes.XL_BUS_TYPE_LIN);
     Trace.WriteLine("XL_GetApplConfig : " + status);
     chMask = driver.XL_GetChannelMask(hwType, (int)hardwareIndex, (int)hardwareChannel);
     chIdx  = driver.XL_GetChannelIndex(hwType, (int)hardwareIndex, (int)hardwareChannel);
     Trace.WriteLine("chMask : " + chMask + " chIdx: " + chIdx);
     if (chIdx < 0 || chIdx >= driverConfig.channelCount)
     {
         return(false);
     }
     return((driverConfig.channel[chIdx].channelBusCapabilities & XLDefine.XL_BusCapabilities.XL_BUS_ACTIVE_CAP_LIN) != 0);
 }
Exemplo n.º 2
0
        // -----------------------------------------------------------------------------------------------



        // -----------------------------------------------------------------------------------------------
        /// <summary>
        /// Displays the Vector Hardware Configuration.
        /// </summary>
        // -----------------------------------------------------------------------------------------------
        private void PrintConfig()
        {
            channelIndex = driver.XL_GetChannelIndex(hwType, (int)hwIndex, (int)hwChannel);

            if (channelIndex > -1)
            {
                Console.WriteLine("\n\nAPPLICATION CONFIGURATION");
                Console.WriteLine("-------------------------------------------------------------------\n");
                Console.WriteLine("Configured Hardware Channel : " + driverConfig.channel[channelIndex].name);
                Console.WriteLine("Hardware Driver Version     : " + driver.VersionToString(driverConfig.channel[channelIndex].driverVersion));
                Console.WriteLine("Used Transceiver            : " + driverConfig.channel[channelIndex].transceiverName);
                Console.WriteLine("Baudrate                    : " + driverConfig.channel[channelIndex].busParams.bitrate);
                Console.WriteLine("-------------------------------------------------------------------\n");
            }
        }
Exemplo n.º 3
0
        /////////////////////////////////////////////////////////////////////////
        ///
        public bool GetAppChannelAndTestIsOk(uint appChIdx, ref UInt64 chMask, ref int chIdx)
        {
            XLDefine.XL_Status status = UDSDemo.XL_GetApplConfig(appName, appChIdx, ref hwType, ref hwIndex, ref hwChannel, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
            {
                Console.WriteLine("XL_Get application Configuration:" + status + Environment.NewLine);
            }

            chMask = UDSDemo.XL_GetChannelMask(hwType, (int)hwIndex, (int)hwChannel);
            chIdx  = UDSDemo.XL_GetChannelIndex(hwType, (int)hwIndex, (int)hwChannel);
            if (chIdx < 0 || chIdx >= driverConfig.channelCount)
            {
                // the (hwType, hwIndex, hwChannel) triplet stored in the application configuration does not refer to any available channel.
                return(false);
            }

            // test if CAN is available on this channel
            return((driverConfig.channel[chIdx].channelBusCapabilities & XLDefine.XL_BusCapabilities.XL_BUS_ACTIVE_CAP_CAN) != 0);
            /////////////////////////////////////////////////////////////////////////
            ///
        }
        private static bool GetAppChannelAndTestIsOk(uint appChIdx, ref UInt64 chMask, ref int chIdx)
        {
            XL_Status status = CANDriver.XL_GetApplConfig(appName, appChIdx, ref hwType, ref hwIndex, ref hwChannel, XL_BusTypes.XL_BUS_TYPE_CAN);

            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                Console.WriteLine("XL_GetApplConfig      : " + status);
                PrintFunctionError();
            }

            chMask = CANDriver.XL_GetChannelMask(hwType, (int)hwIndex, (int)hwChannel);
            chIdx  = CANDriver.XL_GetChannelIndex(hwType, (int)hwIndex, (int)hwChannel);
            if (chIdx < 0 || chIdx >= driverConfig.channelCount)
            {
                // the (hwType, hwIndex, hwChannel) triplet stored in the application configuration does not refer to any available channel.
                return(false);
            }

            // test if CAN is available on this channel
            return((driverConfig.channel[chIdx].channelBusCapabilities & XL_BusCapabilities.XL_BUS_ACTIVE_CAP_CAN) != 0);
        }
Exemplo n.º 5
0
        private bool GetAppChannelAndTestIsOk(uint appChIdx, ref UInt64 chMask, ref int chIdx)
        {
            XLDefine.XL_Status status = CANDriver.XL_GetApplConfig(appName, appChIdx, ref hwType, ref hwIndex, ref hwChannel, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                info += "XL_GetApplConfig      : " + status + "\n";
            }

            chMask = CANDriver.XL_GetChannelMask(hwType, (int)hwIndex, (int)hwChannel);
            chIdx  = CANDriver.XL_GetChannelIndex(hwType, (int)hwIndex, (int)hwChannel);
            if (chIdx < 0 || chIdx >= driverConfig.channelCount)
            {
                return(false);
            }

            if ((driverConfig.channel[chIdx].channelBusCapabilities & XLDefine.XL_BusCapabilities.XL_BUS_ACTIVE_CAP_CAN) == 0)
            {
                return(false);
            }

            if (canFdModeNoIso > 0)
            {
                if ((driverConfig.channel[chIdx].channelCapabilities & XLDefine.XL_ChannelCapabilities.XL_CHANNEL_FLAG_CANFD_BOSCH_SUPPORT) == 0)
                {
                    info += driverConfig.channel[chIdx].name.TrimEnd(' ', '\0') + " " + driverConfig.channel[chIdx].transceiverName.TrimEnd(' ', '\0') + " does not support CAN FD NO-ISO";
                    return(false);
                }
            }
            else
            {
                if ((driverConfig.channel[chIdx].channelCapabilities & XLDefine.XL_ChannelCapabilities.XL_CHANNEL_FLAG_CANFD_ISO_SUPPORT) == 0)
                {
                    info += driverConfig.channel[chIdx].name.TrimEnd(' ', '\0') + " " + driverConfig.channel[chIdx].transceiverName.TrimEnd(' ', '\0') + " does not support CAN FD ISO";
                    return(false);
                }
            }

            return(true);
        }