📄 bocom.pas
字号:
unit Bocom;
//***********************************************************
//本类是根据Bocom大屏的矩阵服务器管理软件编写,用作开发客户端程序,因此本类
//中封装了跟服务器通讯的基本接口,如连接、断开连接、发送信息等指令接口,以及
//delaytime等参数接口,在此基础上可以很容易完成应用程序开发。
//具体是用方法:
//1 调用Connection(Ip:string;Port:integer)过程进行服务器连接 。
//2 设置返回信息等待时间delaytime,调用控制命令函数,完成数据发送并返回信息。
//3 调用DisConnection过程断开与服务器的连接。
//**********************************************************
interface
uses
SysUtils, Forms, ScktComp,DateUtils, Dialogs,classes;
type
TBocom = class //自定义基类
//------------------------------------------------------------------------------------------
private //内部变量、函数和过程定义
CommandStr:string; //命令字符串
BackMessage:string; //控制命令反馈信息
client : Tclientsocket; //生成TclientSocket对象
function SendMessage:string ; //发送信息
procedure ReadMessage(Sender: TObject;Socket: TCustomWinSocket); //读取信息事件
//-----------------------------------------------------------------------------------------
public //外部可见变量和函数定义
DelayTime:integer;// 接收信息延迟时间设置,在时间范围内接收信息,超出后跳出。
//*********************外部可调用过程********************************
//--//视频信号控制---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function VideoShow(VideoShow_Source:string;VideoShow_Left:integer;VideoShow_Top:integer;VideoShow_Width:integer;VideoShow_Hight:integer;VideoShow_ID:integer):string;//开视频
function VideoSize(VideoSize_Source:string;VideoSize_Width:integer;VideoSize_Hight:integer):string;//调整大小
function VideoMove(VideoMove_Source:string;VideoMove_Left:integer;VideoMove_Top:integer):string;//移动位置
function VideoClose(VideoClose_Source:string):string;//关闭视频
function VideoTop(VideoTop_Source:string):string;//前置窗口
function VideoBright(VideoBright_Source:string;VideoBright_Value:integer):string;//调整亮度
function VideoContrast(VideoContrast_Source:string;VideoContrast_Value:integer):string;//调整对比度
function VideoHue(VideoHue_Source:string;VideoHue_Value:integer):string;//调整色度
function VideoFormatN(VideoFormatN_Source:string):string;//信号制式ntsc
function VideoFormatS(VideoFormatS_Source:string):string;//信号制式secam
function VideoFormatP(VideoFormatP_Source:string):string;//信号制式pal
//-----摄像机信号控制-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function CameraNear(CameraNear_Speed:integer;CameraNear_Num:integer):string;//摄像机拉近开始
function CameraStopNear(CameraStopNear_Num:integer):string;//摄像机拉近结束
function CameraFar(CameraFar_Speed:integer;CameraFar_Num:integer):string;//摄像机拉远开始
function CameraStopFar(CameraStopFar_Num:integer):string;//摄像机拉远结束
function CameraUp(CameraUp_Speed:integer;CameraUp_Num:integer):string;//摄像机上移开始
function CameraStopUp(CameraStopUp_Num:integer):string;//摄像机上移结束
function CameraDown(CameraDown_Speed:integer;CameraDown_Num:integer):string;//摄像机下移开始
function CameraStopDown(CameraStopDown_Num:integer):string;//摄像机下移结束
function CameraLeft(CameraLeft_Speed:integer;CameraLeft_Num:integer):string;//摄像机左移开始
function CameraStopLeft(CameraStopLeft_Num:integer):string;//摄像机左移结束
function CameraRight(CameraRight_Speed:integer;CameraRight_Num:integer):string;//摄像机右移开始
function CameraStopRight(CameraStopRight_Num:integer):string;//摄像机右移结束
function CameraFocusFar(CameraFocusFar_Speed:integer;CameraFocusFar_Num:integer):string;//调远焦距开始
function CameraStopFocusFar(CameraStopFocusFar_Num:integer):string;//调远焦距结束
function CameraFocusNear(CameraFocusNear_Speed:integer;CameraFocusNear_Num:integer):string;//调近焦距开始
function CameraStopFocusNear(CameraStopFocusNear_Num:integer):string;//调近焦距结束
//RGB信号控制---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function RGBShow(RGBShow_Source:string;RGBShow_Left:integer;RGBShow_Top:integer;RGBShow_Width:integer;RGBShow_Hight:integer;RGBShow_ID:integer):string;//开RGB信号
function RGBMove(RGBMove_Source:string;RGBMove_Left:integer;RGBMove_Top:integer):string;//移动位置
function RGBSize(RGBSize_Source:string;RGBSize_Width:integer;RGBSize_Hight:integer):string;//调整大小
function RGBTop(RGBTop_Source:string):string;//前置窗口
function RGBLeft(RGBLeft_Source:string):string;//信号源左移
function RGBRight(RGBRight_Source:string):string;//信号源右移
function RGBUp(RGBUp_Source:string):string;//信号源上移
function RGBDown(RGBDown_Source:string):string;//信号源下移
function RGBBrightUp(RGBBrightUp_Source:string):string;//调整亮度+
function RGBBrightDown(RGBBrightDown_Source:string):string;//调整亮度-
function RGBContrastUp(RGBContrastUp_Source:string):string;//调整对比度+
function RGBContrastDown(RGBContrastDown_Source:string):string;//调整对比度-
function RGBClose(RGBClose_Source:string):string;//关闭RGB信号
//NetPC控制-----------------------------------------------------------------------------------------------------------------------------------------------------------
function NetPcShow(NetPcShow_Source:string;NetPcShow_Left:integer;NetPcShow_Top:integer;NetPcShow_Width:integer;NetPcShow_Hight:integer;NetPcShow_IP:string):string;//开NETPC
function NetPcMove(NetPcMove_Source:string;NetPcMove_Left:integer;NetPcMove_Top:integer):string;//移动位置
function NetPcTop(NetPcTop_Source:string):string;//前置窗口
function NetPcSize(NetPcSize_Source:string;NetPcSize_Width:integer;NetPcSize_Hight:integer):string;//调整大小
function NetPcClose(NetPcClose_Source:string):string;//关NETPC
//其他控制---------------------------------------------------------------------------------------------------------------------------------------------------------------------
function MaxRGBShow(MaxRGBShow_Source:string;MaxRGBShow_Left:integer;MaxRGBShow_Top:integer;MaxRGBShow_Width:integer;MaxRGBShow_Hight:integer;MaxRGBShow_ID:integer;MaxRGBShow_RowCount:integer;MaxRGBShow_ColCount:integer):string;//开RGB信号
function MaxRGBClose(MaxRGBClose_Source:string):string;//关闭RGB信号
function MaxVideoShow(MaxVideoShow_Source:string;MaxVideoShow_Left:integer;MaxVideoShow_Top:integer;MaxVideoShow_Width:integer;MaxVideoShow_Hight:integer;MaxVideoShow_ID:integer;MaxVideoShow_RowCount:integer;MaxVideoShow_ColCount:integer):string;//开VIDEO信号
function MaxVideoClose(MaxVideoClose_Source:string):string;//关闭VIDEO信号
function ProjectorShow(ProjectorShow_Source:string;ProjectorShow_Left:integer;ProjectorShow_Top:integer;ProjectorShow_Width:integer;ProjectorShow_Hight:integer;ProjectorShow_ID:integer;ProjectorShow_RowCount:integer;ProjectorShow_ColCount:integer):string;//开投影机信灯
function ProjectorClose(ProjectorClose_Source:string):string;//关闭投影机信灯
function Login(Login_UserID:string;Login_Password:string):string;//登记用户
function ListCamera():string;//列出摄像机信号
function ListNetPc():string;//列出netpc信号
function ListRGB():string;//列出rgbpc信号
function ListScheme():string;//列出预案
function ListDirectChannel():string;//列出直接通信号
function ListLiveWnd():string;//列出当前显示窗
function Unlogin():string;//注销用户
{ //---------------------------------------
function MaxVideoToRGB1():string;//maxvideo switch RGB1
function MaxVideoToRGB2():string;//maxvideo switch RGB2
function MaxVideoToVideo():string;// maxvideo switch VIDEO
function MaxVideoOnAll():string;//maxvideo power onall
function MaxVideoOffAll():string;//maxvideo power Offall
//直接通道信号控制---------------------------------------------------------------------------------------------------------------------
function DChannelShow(DChannelShow_Source:string;DChannelShow_Left:integer;DChannelShow_Top:integer;DChannelShow_Width:integer;DChannelShow_Hight:integer;DChannelShow_ID:integer):string;//开通道信号
function DChannelMove(DChannelMove_Source:string;DChannelMove_Left:integer;DChannelMove_Top:integer):string;//移动位置
function DChannelTop(DChannelTop_Source:string):string;//前置窗口
function DChannelSize(DChannelSize_Source:string;DChannelSize_Left:integer;DChannelSize_Top:integer):string;//调整大小
function DChannelClose(DChannelClose_Source:string):string;//关通道信号
function DChannelN(DChannelN_Mode:string;DChannelN_Source:string):string;//信号制式ntsc
function DChannelS(DChannelS_Mode:string;DChannelS_Source:string):string;//信号制式secam
function DChannelP(DChannelP_Mode:string;DChannelP_Source:string):string;//信号制式pal
function DChannelBright(DChannelBright_Source:string;DChannelBright_Value:integer):string;//调整亮度
function DChannelContrast(DChannelContrast_Source:string;DChannelContrast_Value:integer):string;//调整对比度
function DChannelHue(DChannelHue_Source:string;DChannelHue_Value:integer):string;//调整色度
function DChannelChange(DChannelChange_Source:string;DChannelChange_Value:integer):string;//更改信号源
}
//*********************************************
constructor create;
procedure Connection(Ip:string;Port:integer);
procedure DisConnection;
end;
//*************************命令字符串常量*******************************
const
//-------------------------------------------------------------------------------
VideoShow_Cmd='ntvideo show';
VideoSize_Cmd='ntvideo size';
VideoMove_Cmd='ntvideo move';
VideoClose_Cmd='ntvideo close';
VideoTop_Cmd='gotop';
VideoBright_Cmd='ntvideo brightness';
VideoContrast_Cmd='ntvideo contrast';
VideoHue_Cmd='hue';
VideoFormatN_Cmd='ntvideo format ntsc';
VideoFormatS_Cmd='ntvideo format secam';
VideoFormatP_Cmd='ntvideo format pal';
//-------------------------------------------------------------------------------
CameraNear_Cmd='camera near';
CameraStopNear_Cmd='camera stopnear';
CameraFar_Cmd='camera far';
CameraStopFar_Cmd='camera stopfar';
CameraUp_Cmd='camera up';
CameraStopUp_Cmd='camera stopup';
CameraDown_Cmd='camera down';
CameraStopDown_Cmd='camera stopdown';
CameraLeft_Cmd='camera left';
CameraStopLeft_Cmd='camera stopleft';
CameraRight_Cmd='camera right';
CameraStopRight_Cmd='camera stopright ';
CameraFocusFar_Cmd='camera focus> ';
CameraStopFocusFar_Cmd='camera stopfocus>';
CameraFocusNear_Cmd='camera focus<';
CameraStopFocusNear_Cmd='camera stopfocus<';
RGBShow_Cmd='rgbpc show';
RGBMove_Cmd='rgbpc move';
RGBSize_Cmd='rgbpc size';
RGBTop_Cmd='gotop';
RGBLeft_Cmd='rgbpc left';
RGBRight_Cmd='rgbpc right';
RGBUp_Cmd='rgbpc up';
RGBDown_Cmd='rgbpc down';
RGBBrightUp_Cmd='rgbpc brightnessup';
RGBBrightDown_Cmd='rgbpc brightnessdown';
RGBContrastUp_Cmd='rgbpc contrastup';
RGBContrastDown_Cmd='rgbpc contrastdown';
RGBClose_Cmd='rgbpc close';
DChannelShow_Cmd='directchannel show';
DChannelMove_Cmd='directchannel move';
DChannelTop_Cmd='';
DChannelSize_Cmd='directchannel size';
DChannelClose_Cmd='directchannel close';
DChannelN_Cmd='directchannel format ntsc';
DChannelS_Cmd='directchannel format secam';
DChannelP_Cmd='directchannel format pal';
DChannelBright_Cmd='directchannel brightness';
DChannelContrast_Cmd='directchannel contrast';
DChannelHue_Cmd='directchannel hue';
DChannelChange_Cmd='directchannel source';
NetPcShow_Cmd='netpc show';
NetPcMove_Cmd='netpc move';
NetPcTop_Cmd='gotop';
NetPcSize_Cmd='netpc size';
NetPcClose_Cmd='netpc close';
Login_Cmd='manager login ';
ListCamera_Cmd='list camera';
ListNetPc_Cmd='list netpc';
ListRGB_Cmd='list rgbpc';
ListScheme_Cmd='list scheme';
ListDirectChannel_Cmd='list directchannel';
ListLiveWnd_Cmd='list livewnd';
Unlogin_Cmd='Manager unlogin';
MaxRGBShow_Cmd='maxrgbpc show';
MaxRGBClose_Cmd='maxrgbpc close';
MaxVideoShow_Cmd='maxvideo show';
MaxVideoClose_Cmd='maxvideo close';
ProjectorShow_Cmd='maxvideo show';
ProjectorClose_Cmd='maxvideo close';
MaxVideoToRGB1_Cmd='maxvideo switch RGB1';
MaxVideoToRGB2_Cmd='maxvideo switch RGB2';
MaxVideoToVideo_Cmd='maxvideo switch VIDEO';
MaxVideoOnAll_Cmd='maxvideo power onall';
MaxVideoOffAll_Cmd='maxvideo power offall';
implementation
constructor TBocom.create;
begin
client := tclientsocket.Create(client);
client.OnRead := readmessage;
end;
//--//视频信号控制---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function TBocom.VideoShow(VideoShow_Source:string;VideoShow_Left:integer;VideoShow_Top:integer;VideoShow_Width:integer;VideoShow_Hight:integer;VideoShow_ID:integer):string; //开视频
begin
CommandStr:=VideoShow_Cmd+' '+VideoShow_Source+' '+inttostr(VideoShow_Left)+' '+inttostr(VideoShow_Top)+' '+inttostr(VideoShow_Width)+' '+inttostr(VideoShow_Hight)+' '+inttostr(VideoShow_ID)+' -1 -1' ;
result:=SendMessage;
end;
function TBocom.VideoSize(VideoSize_Source:string;VideoSize_Width:integer;VideoSize_Hight:integer):string; //调整大小
begin
CommandStr:=VideoSize_Cmd+' '+VideoSize_Source+' '+inttostr(VideoSize_Width)+' '+inttostr(VideoSize_Hight) ;
result:=SendMessage;
end;
function TBocom.VideoMove(VideoMove_Source:string;VideoMove_Left:integer;VideoMove_Top:integer):string; //移动位置
begin
CommandStr:=VideoMove_Cmd+' '+VideoMove_Source+' '+inttostr(VideoMove_Left)+' '+inttostr(VideoMove_Top) ;
result:=SendMessage;
end;
function TBocom.VideoClose(VideoClose_Source:string):string; //关闭视频
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -