Exemple #1
0
 private static extern int CAENDPP_AddBoard(int handle, ConnParam connParam, ref int bID);
Exemple #2
0
        /// <summary>
        /// Function that initializes the library, adds the board and sends the default and custom configuration. 
        /// </summary>
        public static bool Init()
        {
            IsInit = false;

            if (MyGlobals.OffLineMode == true)
                return false;

            //Init library
            int ret = CAENDPP_InitLibrary(ref handle);
            if (ret != 0) { trace.Value.TraceEvent(TraceEventType.Error, 0, "Error " + ret + ": " + GetErrorText(ret)); return false; }
            else { trace.Value.TraceEvent(TraceEventType.Information, 0, "Library initialized"); }

            //Add board
            ConnParam connParam = new ConnParam { LinkType = 0, LinkNum = 0, ConetNode = 0 };

            ret = CAENDPP_AddBoard(handle, connParam, ref bID);
            if (ret != 0) { trace.Value.TraceEvent(TraceEventType.Error, 0, "Error " + ret + ": " + GetErrorText(ret)); return false; }
            else { trace.Value.TraceEvent(TraceEventType.Information, 0, "Board added"); }

            //Reset board to default parameters
            SetDefaultConfig();

            LoadCustomChannelConfigs();

            SendConfig();

            IsInit = true;
            return true;
        }