索尼VTR(9针)硬件想要使用c#应用程序控制。我不知道如何与com端口进行通信/发送命令。我想执行播放,暂停像命令也获取视频的当前时间码,建议我c#中的示例代码。
答案 0 :(得分:0)
// Create the serial port with basic settings
//change parity bit,COM name,bit rate,baud rate according to requirements.
private SerialPort port = new SerialPort("COM1",38400, Parity.Odd, 8, StopBits.One);
public byte[] play()
{
var checkCommand = new byte[6];
checkCommand[0] = 0x20;
checkCommand[1] = 0x01;
checkCommand[2] = 0x21;
checkCommand[3] = 0x00;
checkCommand[4] = 0x00;
checkCommand[5] = 0x00;
try
{
if (!port.IsOpen)
{
port.Open();
}
port.Write(checkCommand, 0, checkCommand.Length);
return checkCommand;
}
catch (ArgumentException ex)
{
throw new InvalidOperationException("Locker cell can not be opened.", ex);
}
}