public void OpenVideo() { p.StartInfo.FileName = "ffmpeg.exe"; p.StartInfo.Arguments = "-f dshow -i video=\"PC Camera\" -s 1366x768 -aspect 16:9 -vcodec mpeg2video -f mpeg2video udp://192.168.2.13:8888"; //此处后面需要更改为上位机IP try { p.Start(); } catch (Exception e) { videoLog.WriteLog("打开ffmpeg失败", e.ToString()); } }
/// <summary> /// init /// </summary> public void InitIo() { if (HANDLE != null) { aaeonSmbusClose(HANDLE); } HANDLE = aaeonSmbusOpen(); try { aaeonSmbusWriteByte(HANDLE, 0X6E, (byte)(GROUP * 16), 0xFF); //all output aaeonSmbusWriteByte(HANDLE, 0X6E, (byte)(GROUP * 16 + 1), 0x00); //all low } catch (Exception e) { gpioLog.WriteLog("gpio初始化失败", e.ToString()); } }
/// <summary> /// TCPServer 构造函数 /// </summary> /// <param name="port"></param> /// <param name="count"></param> public TcpServer(int port, int count) { _ip = GetLocalIPV4(); Port = port; _maxClientCount = count; _mClientSockets = new List <Socket>(); //初始化IP终端 _ipEndPoint = new IPEndPoint(IPAddress.Any, port); //初始化服务器端Socket _mServerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); //Socket绑定端口 _mServerSocket.Bind(_ipEndPoint); //设置监听数目 _mServerSocket.Listen(_maxClientCount); //写日志记录 tcpLog.WriteLog("Tcp init", IP); }
private static void cutData_Write(int length, byte[] buf) { int count = 1; while (length >= 7) { if (buf[count] == 0x03) { currentLog.WriteLog(buf[count - 1].ToString() + "电机", (buf[count + 2] * 2.56 + buf[count + 3] * 0.01).ToString() + "安"); switch (buf[count - 1]) { case 0x01: temp1Log.ClearLog(); temp1Log.WriteLog(buf[count - 1].ToString(), (buf[count + 2] * 2.56 + buf[count + 3] * 0.01).ToString()); break; case 0x02: temp2Log.ClearLog(); temp2Log.WriteLog(buf[count - 1].ToString(), (buf[count + 2] * 2.56 + buf[count + 3] * 0.01).ToString()); break; case 0x03: temp3Log.ClearLog(); temp3Log.WriteLog(buf[count - 1].ToString(), (buf[count + 2] * 2.56 + buf[count + 3] * 0.01).ToString()); break; case 0x04: temp4Log.ClearLog(); temp4Log.WriteLog(buf[count - 1].ToString(), (buf[count + 2] * 2.56 + buf[count + 3] * 0.01).ToString()); break; } count += 7; length -= 7; } else { count += 8; length -= 8; } } }
private static bool emergyStop; //emeergy-stop flag private static void Main(string[] args) { JSON_Init(); Main_init(); //初始化 Console.WriteLine("主程序初始化成功"); mainLog.WriteLog("主程序初始化成功", ""); CarCtr(); //car-process }