Search code examples
c#.netvectorcanoeautomotive

Set signal value using .NET from Visual studio in CANoe


how can i change signal value in CANoe from C# in Visual Studio? I don't want to make a test module and run it from CANoe, i just want to run from Visual Studio and signal value to be changed. I get this error when i'm trying to set a signal value:

Vector.CANoe.Runtime.Internal.DBTypeNotFoundException: 'The type SignalName could not be found in the configuration.'

    using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using Vector.PanelControlPlugin;
using NetworkDB;
using Vector.CANoe.Runtime;
using Vector.CANoe.Runtime.Internal;
using Vector.CANoe.Runtime.ValueEntitiesInternal;
using Vector.PostCompiler;
using Vector.CANoe.Sockets;
 
using Vector.CANoe.VTS;
 
using Vector.CANoe.VTSInternal;
using Vector.Diagnostics;
using NetworkDB;
 
 
namespace Demo
{
    public class Class1// : IPanelControlPluginLibrary
    {
        [OnChange(typeof(NetworkDB.PAAK_WELCOME_LIGHTS))]
        public static void OnSignalLockState()
        {
            double value = 1;
            NetworkDB.PAAK_WELCOME_LIGHTS.Instance.GetValue();
            
        }
        static void Main(String[] args)
        {
            OnSignalLockState();
        }
    }
}

Solution

  • The assemblies Vector.CANoe.Runtime can only be used in .NET code which is run within CANoe, i.e. in Nodes, Tests, Snippets, etc.

    If you want to interact with CANoe from outside you have to use the COM-Interface of CANoe.