//--------------------------------------------------------------------------- #ifndef Unit1H #define Unit1H //--------------------------------------------------------------------------- #include #include #include #include #include #include #include #include "winsock2.h" #include #pragma pack(push, 1) typedef struct{ unsigned short length; unsigned char msgType; unsigned char sequence; }VeoMsgHeader; typedef struct{ VeoMsgHeader hdr; char user[64]; char password[64]; }VeoLogonRequest; typedef struct{ unsigned short width; unsigned short height; unsigned long maxTime; unsigned long minTime; }VeoStreamInfo; typedef struct{ VeoMsgHeader hdr; unsigned char protoMajor; unsigned char protoMinor; unsigned char accessLevel; unsigned long streamID; unsigned char format; unsigned long timePerFrame; unsigned long maxBrightness; unsigned char streamCount; VeoStreamInfo streams[64]; }VeoLogonResponse; typedef struct{ VeoMsgHeader hdr; char moveDirection; }VeoMoveRequest; typedef struct{ VeoMsgHeader hdr; char onOff; }VeoStatusLightRequest; typedef struct{ VeoMsgHeader hdr; unsigned long brightness; }VeoSetBrightnessRequest; typedef struct{ VeoMsgHeader hdr; char streamType; unsigned long delayTime; }VeoStreamSelectRequest; typedef struct{ VeoMsgHeader hdr; unsigned long streamID; unsigned short reserved; unsigned char audio; }VeoStartStreamRequest; typedef struct{ VeoMsgHeader hdr; }VeoStartStreamResponse; typedef struct{ unsigned short size; unsigned char type; unsigned char data[4000]; }VeoReceivedPacket; typedef struct{ unsigned short size; unsigned char type; unsigned short frameNo; unsigned short seqNo; unsigned char rate; unsigned char timestamp[8]; unsigned char reserved[6]; unsigned short height; unsigned short width; unsigned char data[4000]; }VeoReceivedPacket0; typedef struct{ unsigned short size; unsigned char type; unsigned short frameNo; unsigned short seqNo; unsigned char rate; unsigned char data[4000]; }VeoReceivedPacket1; #pragma pack(pop) //--------------------------------------------------------------------------- class TForm1 : public TForm { __published: // IDE-managed Components TLabeledEdit *txtAddress; TButton *cmdConnect; TButton *cmdDisconnect; TLabeledEdit *txtPort; TXPManifest *XPManifest1; TLabeledEdit *txtUser; TLabeledEdit *txtPass; TGroupBox *GroupBox1; TButton *btnMoveUp; TButton *btnMoveLeft; TButton *btnMoveRight; TButton *btnMoveDown; TGroupBox *GroupBox2; TButton *btnStatusOn; TButton *btnStatusOff; TGroupBox *GroupBox3; TButton *btnStreamSelect1; TButton *btnStreamSelect2; TButton *btnStreamSelect3; TGroupBox *GroupBox4; TButton *btnStreamStart; TButton *btnStreamStop; TButton *btnReset; TTimer *Timer1; TGroupBox *GroupBox5; TPaintBox *PaintBox1; TButton *Button1; TGroupBox *GroupBox6; TTrackBar *tbBrightness; TScrollBar *sbGrippy; void __fastcall cmdConnectClick(TObject *Sender); void __fastcall FormClose(TObject *Sender, TCloseAction &Action); void __fastcall cmdDisconnectClick(TObject *Sender); void __fastcall btnMoveUpClick(TObject *Sender); void __fastcall btnStatusOnClick(TObject *Sender); void __fastcall btnStreamSelect1Click(TObject *Sender); void __fastcall btnStreamStartClick(TObject *Sender); void __fastcall btnStreamStopClick(TObject *Sender); void __fastcall btnResetClick(TObject *Sender); void __fastcall Timer1Timer(TObject *Sender); void __fastcall Button1Click(TObject *Sender); void __fastcall tbBrightnessChange(TObject *Sender); private: // User declarations public: // User declarations SOCKET hSock; SOCKADDR_IN LocalAddr, RemoteAddr; fd_set sockSet; struct timeval blockTime; void SetSendTimeout(); void SetRecvTimeout(); unsigned char rsbuf[4096]; unsigned char jpegBuf[100000]; int jpegLength; unsigned char jpegCurrent[100000]; int jpegCurrentLength; Graphics::TBitmap* bmp; unsigned long streamID; unsigned char sequence; bool stopping, gettingSnapshot; __fastcall TForm1(TComponent* Owner); }; //--------------------------------------------------------------------------- extern PACKAGE TForm1 *Form1; //--------------------------------------------------------------------------- #endif