Ejemplo n.º 1
0
        private void OnSDKInit()
        {
            //获取存储SDK 版本
            int major = 0, minor = 0;

            //SetConsoleCtrlHandler(CosonleHandler, TRUE);
            SDKApi.EagleData_GetVersion(ref major, ref minor);
            Console.WriteLine(string.Format("SDK Version: {0}.{1}\n", major, minor));
            LogHelper.WriteLog(string.Format("SDK Version: {0}.{1}\n", major, minor));
            //所有在本地计算机上网卡列表

            eagle_all_netcards nics = new eagle_all_netcards();

            int ret = SDKApi.EagleControl_GetSystemNICs(ref nics);

            LogHelper.WriteLog(nics.card_num.ToString());

            for (int i = 1; i <= nics.card_num; i++)
            {
                LogHelper.WriteLog(string.Format("{0} : {1}\n", i, nics.cards[i - 1].dev_description));
            }

            /*
             * get device number
             */
            int device_num = 0;

            ret = SDKApi.EagleControl_ScanAndGetDeviceNum(ref device_num);
            LogHelper.WriteLog(string.Format("get device numbers {0}", device_num));

            /*
             * get device ids
             */
            int[] device_ids = new int[device_num];
            int   ids        = 0;
            //ret = SDKApi.EagleControl_GetDeviceIds(out device_ids, device_num, ref ids);
            //LogHelper.WriteLog("get device ids:\n");
            //for (int i = 0; i < ids; i++)
            //{
            //    LogHelper.WriteLog(string.Format(" ** {0}: device id {1}\n", i + 1, device_ids[i]));
            //}

            /*
             * init data api
             */
            var initdevice = SDKApi.EagleData_Init();

            LogHelper.WriteLog(string.Format("init eagle data {0}", initdevice));
        }