public SmcErr StartControlPtz(string cameraNo, PtzCommandType ptzCommand, int param)
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: IvsVideoMonitor.StartControlPtz({0},{1},{2}).", cameraNo, ptzCommand, param);
SmcErr err = new CgwError();
//将ptz命令转换成IVS的命令
string name = Enum.GetName(typeof(PtzCommandType), ptzCommand);
if (Enum.IsDefined(typeof(IvsPtzCommandType), name))
{
IvsPtzCommandType ivsPtzCommandType = (IvsPtzCommandType)Enum.Parse(typeof(IvsPtzCommandType), name);
logEx.Trace("Call ivsSdkClient.StartPtzControl({0},{1},{2}).", cameraNo, (int)ivsPtzCommandType, param);
int result = this.ivsSdkClient.StartPtzControl(cameraNo, (int)ivsPtzCommandType, param.ToString());
//如果为0,表示成功
if (result == CgwConst.IVS_SDK_SUCCESS_TAG)
{
logEx.Info("Start control ptz success.Camera No:{0}.", cameraNo);
}
else
{
err.SetErrorNo(CgwError.START_CONTROL_PTZ_FAILED);
logEx.Error("Start control ptz failed.Camera No:{0}.Ivs sdk error code:{1}.", cameraNo, result);
return err;
}
}
else
{
err.SetErrorNo(CgwError.START_CONTROL_PTZ_FAILED);
logEx.Error("The ivs monitor is not support the command.ptzCommand:{0}.", ptzCommand);
return err;
}
return err;
}