已阅读5页,还剩16页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
智能家居视频监控系统 简介 本系统采用了 360 度无死角摄像头 可全方位监控自己的住所 并且可以锁定监控 例如门外 监控系统可在 pc 端查看记录 并且可以设定场景锁定 若场景发生变化 便会触发 报警系统 给设定的邮箱或手机发送邮件及短信提醒 实时告知用户紧急状况 此系统可以进行远程监控 即用户可以不在家里的 pc 端进行监控 只要用户可以上 网 就可通过与被控端连接的计算机外网 ip 地址监控住所的一切动向 这让监控变得简洁化及随身化 代码 1 Login cs using System using System Collections Generic using System ComponentModel using System Data using System Drawing using System Text using System Windows Forms 添加的命名空间 using System Data OleDb using VWMS CommonClass namespace VWMS public partial class frmLogin Form public frmLogin InitializeComponent DataCon datacon new DataCon DataOperate dataoperate new DataOperate private void btnLogin Click object sender EventArgs e if txtName Text errorProName SetError txtName 用户名不能为空 else errorProName Clear string strSql select from tb admin where name txtName Text and pwd txtPwd Text DataSet ds dataoperate getDs strSql tb admin if ds Tables 0 Rows Count 0 this Hide frmMain frmmain new frmMain frmmain Show else MessageBox Show 用户名或密码错误 警告 MessageBoxButtons OK MessageBoxIcon Warning private void btnExit Click object sender EventArgs e Application Exit private void txtName KeyPress object sender KeyPressEventArgs e if e KeyChar 13 txtPwd Focus e Handled true private void txtPwd KeyPress object sender KeyPressEventArgs e if e KeyChar 13 btnLogin Focus e Handled true private void frmLogin Load object sender EventArgs e 2 SetMonitor cs using System using System Collections Generic using System ComponentModel using System Data using System Drawing using System Text using System Windows Forms using System Data OleDb using VWMS CommonClass namespace VWMS public partial class frmSetMonitor Form public frmSetMonitor InitializeComponent DataOperate dataoperate new DataOperate DataSet ds private void frmSetMonitor Load object sender EventArgs e lviewBind private void btnAdd Click object sender EventArgs e if txtName Text string Empty MessageBox Show 用户名不能为空 提示 MessageBoxButtons OK MessageBoxIcon Information else ds dataoperate getDs select from tb admin where name txtName Text tb admin if ds Tables 0 Rows Count 0 MessageBox Show 该用户已经存在 提示 MessageBoxButtons OK MessageBoxIcon Information else dataoperate getCom insert into tb admin name pwd values txtName Text txtPwd Text lviewBind txtName Text txtPwd Text string Empty private void btnEdit Click object sender EventArgs e if txtName Text string Empty else dataoperate getCom update tb admin set pwd txtPwd Text where name txtName Text lviewBind txtName Text txtPwd Text string Empty private void btnDel Click object sender EventArgs e if txtName Text ToLower tsoft MessageBox Show 该用户是超级用户 不能删除 警告 MessageBoxButtons OK MessageBoxIcon Warning else dataoperate getCom delete from tb admin where name txtName Text lviewBind txtName Text lview Items 0 Text private void lview Click object sender EventArgs e txtName Text lview SelectedItems 0 Text txtPwd Text string Empty public void lviewBind lview Items Clear ds dataoperate getDs select name from tb admin tb admin foreach DataRow dr in ds Tables 0 Rows ListViewItem lvItem new ListViewItem dr 0 ToString 0 lvItem SubItems Add dr 0 ToString lview Items Add lvItem 3 Register cs using System using System Collections Generic using System ComponentModel using System Data using System Drawing using System Text using System Windows Forms using VWMS CommonClass using Microsoft Win32 namespace VWMS public partial class frmRegister Form public frmRegister InitializeComponent SoftReg softreg new SoftReg private void frmRegister Load object sender EventArgs e txtMNum Text softreg getMNum private void btnReg Click object sender EventArgs e if txtRNum Text Equals softreg getRNum RegistryKey retkey Microsoft Win32 Registry CurrentUser OpenSubKey software true CreateSubKey wxk CreateSubKey wxk INI CreateSubKey txtRNum Text retkey SetValue UserName tsoft MessageBox Show 注册成功 信息 MessageBoxButtons OK MessageBoxIcon Information showMain else MessageBox Show 注册码输入错误 错误 MessageBoxButtons OK MessageBoxIcon Error private void btnClose Click object sender EventArgs e showMain 隐藏注册窗体 显示主窗体 public void showMain this Hide frmMain frmmain new frmMain frmmain Show 4 Play cs using System using System Collections Generic using System ComponentModel using System Data using System Drawing using System Text using System Windows Forms namespace VWMS public partial class frmPlay Form public frmPlay InitializeComponent private void btnPlay Click object sender EventArgs e ofDialog Filter avi avi ofDialog Title 选择视频文件 ofDialog InitialDirectory Application StartupPath Substring 0 Application StartupPath LastIndexOf Substring 0 Application StartupPath Substring 0 Application StartupPath LastIndexOf LastIndexOf Video if ofDialog ShowDialog DialogResult OK this axWindowsMediaPlayer1 URL ofDialog FileName private void btnClose Click object sender EventArgs e this Close private void axWindowsMediaPlayer1 Enter object sender EventArgs e 5 Main cs using System using System Collections Generic using System ComponentModel using System Data using System Drawing using System Text using System Windows Forms 添加的命名空间 using VWMS CommonClass using System IO Ports using Microsoft Win32 using System Threading namespace VWMS public partial class frmMain Form public frmMain InitializeComponent PelcoD pelcod new PelcoD SoftReg softreg new SoftReg SerialPort serialPort new SerialPort COM1 2400 Parity None 8 int m dwDevNum 0 byte addressin Byte Parse Convert ToString 0 x01 byte speedin Byte Parse Convert ToString 0 xff byte messagesend private void frmMain Load object sender EventArgs e plVideo1 BackgroundImage null RegistryKey retkey Microsoft Win32 Registry CurrentUser OpenSubKey software true CreateSubKey wxk CreateSubKey wxk INI foreach string strRNum in retkey GetSubKeyNames if strRNum softreg getRNum this Text 智能视频监控系统 btnReg Enabled false startMonitor return this Text 智能视频监控系统 btnReg Enabled true btnSetMonitor Enabled btnAutoMonitor Enabled false startMonitor MessageBox Show 您现在使用的是试用版 该软件可以免费试用30次 提示 MessageBoxButtons OK MessageBoxIcon Information Int32 tLong try tLong Int32 Registry GetValue HKEY LOCAL MACHINE SOFTWARE angel UseTimes 0 MessageBox Show 感谢您已使用了 tLong 次 提示 MessageBoxButtons OK MessageBoxIcon Information catch Registry SetValue HKEY LOCAL MACHINE SOFTWARE angel UseTimes 0 RegistryValueKind DWord MessageBox Show 欢迎新用户使用本软件 提示 MessageBoxButtons OK MessageBoxIcon Information tLong Int32 Registry GetValue HKEY LOCAL MACHINE SOFTWARE angel UseTimes 0 if tLong 30 int Times tLong 1 Registry SetValue HKEY LOCAL MACHINE SOFTWARE angel UseTimes Times else MessageBox Show 试用次数已到 警告 MessageBoxButtons OK MessageBoxIcon Warning Application Exit private void frmMain Move object sender EventArgs e for int i 0 i m dwDevNum i plVideo1 Invalidate VideoOperate VCAUpdateOverlayWnd this Handle VideoOperate VCAUpdateVideoPreview i plVideo1 Handle private void btnSetMonitor Click object sender EventArgs e frmSetMonitor frmsetmonitor new frmSetMonitor frmsetmonitor ShowDialog private void btnVideo Click object sender EventArgs e if btnVideo Text 录像 sfDialog Filter avi avi sfDialog Title 保存视频文件 sfDialog InitialDirectory Application StartupPath Substring 0 Application StartupPath LastIndexOf Substring 0 Application StartupPath Substring 0 Application StartupPath LastIndexOf LastIndexOf Video if sfDialog ShowDialog DialogResult OK btnVideo Text 停止录像 VideoOperate VCASetKeyFrmInterval 0 250 VideoOperate VCASetBitRate 0 256 VideoOperate VCASetVidCapFrameRate 0 25 false VideoOperate VCASetVidCapSize 0 320 240 VideoOperate VCASetXVIDQuality 0 10 3 VideoOperate VCASetXVIDCompressMode 0 VideoOperate COMPRESSMODE XVID VBR MODE VideoOperate VCAStartVideoCapture 0 VideoOperate CAPMODEL CAP MPEG4 STREAM VideoOperate MP4MODEL MPEG4 AVIFILE CALLBACK sfDialog FileName else if btnVideo Text 停止录像 btnVideo Text 录像 VideoOperate VCAStopVideoCapture 0 回放 private void btnPlay Click object sender EventArgs e frmPlay frmpaly new frmPlay frmpaly ShowDialog 快照 private void btnSnapShots Click object sender EventArgs e if rbtnBMP Checked VideoOperate VCASaveAsBmpFile 0 Application StartupPath Substring 0 Application StartupPath LastIndexOf Substring 0 Application StartupPath Substring 0 Application StartupPath LastIndexOf LastIndexOf Photo DateTime Now ToFileTime bmp else VideoOperate VCASaveAsJpegFile 0 Application StartupPath Substring 0 Application StartupPath LastIndexOf Substring 0 Application StartupPath Substring 0 Application StartupPath LastIndexOf LastIndexOf Photo DateTime Now ToFileTime jpg 100 开始自动监控 private void btnAutoMonitor Click object sender EventArgs e if btnAutoMonitor Text 开始 if rbtnWideWatch Checked messagesend pelcod CameraTilt addressin PelcoD Tilt Up speedin serialPort Open serialPort Write messagesend 0 7 serialPort Close Thread Sleep 2000 messagesend pelcod CameraPan addressin PelcoD Pan Left speedin serialPort Open serialPort Write messagesend 0 7 serialPort Close Thread Sleep 2000 messagesend pelcod CameraTilt addressin PelcoD Tilt Down speedin serialPort Open serialPort Write messagesend 0 7 serialPort Close Thread Sleep 2000 messagesend pelcod CameraPan addressin PelcoD Pan Right speedin serialPort Open serialPort Write messagesend 0 7 serialPort Close else if rbtnVerticalWatch Checked messagesend pelcod CameraTilt addressin PelcoD Tilt Up speedin serialPort Open serialPort Write messagesend 0 7 serialPort Close Thread Sleep 2000 messagesend pelcod CameraTilt addressin PelcoD Tilt Down speedin serialPort Open serialPort Write messagesend 0 7 serialPort Close else messagesend pelcod CameraPan addressin PelcoD Pan Left speedin serialPort Open serialPort Write messagesend 0 7 serialPort Close Thread Sleep 2000 messagesend pelcod CameraPan addressin PelcoD Pan Right speedin serialPort Open serialPort Write messagesend 0 7 serialPort Close btnAutoMonitor Text 停止 else stopMove btnAutoMonitor Text 开始 停止监控 private void btnStop Click object sender EventArgs e if btnStop Text 停止 string strDPath Application StartupPath string strPath strDPath Substring 0 strDPath LastIndexOf Substring 0 strDPath Substring 0 strDPath LastIndexOf LastIndexOf Image 主页面 主界面图片 bmp plVideo1 BackgroundImage System Drawing Image FromFile strPath VideoOperate VCAUnInitSdk btnStop Text 开始 else if btnStop Text 开始 plVideo1 BackgroundImage null startMonitor btnStop Text 停止 打开软件注册窗体 private void btnReg Click object sender EventArgs e frmRegister frmregister new frmRegister frmregister Show this Hide region 释放鼠标时 视频监控停止移动 private void btnUp MouseUp object sender MouseEventArgs e stopMove private void btnDown MouseUp object sender MouseEventArgs e stopMove private void btnLeft MouseUp object sender MouseEventArgs e stopMove private void btnRight MouseUp object sender MouseEventArgs e stopMove private void btnAHighlghts MouseUp object sender MouseEventArgs e stopMove private void btnCHighlghts MouseUp object sender MouseEventArgs e stopMove private void btnAFocus MouseUp object sender MouseEventArgs e stopMove private void btnCFocus MouseUp object sender MouseEventArgs e stopMove private void btnAAperture MouseUp object sender MouseEventArgs e stopMove private void btnCAperture MouseUp object sender MouseEventArgs e stopMove private void btnAWipers MouseUp object sender MouseEventArgs e stopMove private void btnCWipers MouseUp object sender MouseEventArgs e stopMove endregion 关闭主窗体时 退出应用程序 private void frmMain FormClosing object sender FormClosingEventArgs e Application Exit 开始监控 protected void startMonitor if VideoOperate VCAInitSdk this Handle VideoOperate DISPLAYTRANSTYPE PCI MEMORY VIDEOMEMORY false m dwDevNum VideoOperate VCAGetDevNum if m dwDevNum 0 MessageBox Show VC404卡驱动程序没有安装 else for int i 0 i m dwDevNum i VideoOperate VCAOpenDevice i plVideo1 Handle VideoOperate VCAStartVideoPreview i 停止移动 protected void stopMove messagesend pelcod CameraStop addressin serialPort Open serialPort Write messagesend 0 7 serialPort Close private void plVideo1 Paint object sender PaintEventArgs e 6 Program cs using System using System Collections Generic using System Windows Forms namespace VWMS static class Program 应用程序的主入口点 STAThread static void Main Application EnableVisualStyles Application SetCompatibleTextRenderingDefault false Application Run new frmLogin 7 DataCon cs using System using System Collections Generic using System Text using System Data using System Data OleDb using System Windows Forms namespace VWMS CommonClass class DataCon public OleDbConnection getCon string strDPath Application StartupPath string strDataSource Provider Microsoft Jet OLEDB 4 0 Data Source strDPath Substring 0 strDPath LastIndexOf Substring 0 strDPath Substring 0 strDPath LastIndexOf LastIndexOf DataBase db VWMS mdb OleDbConnection oledbCon new OleDbConnection strDataSource return oledbCon 8 DataOperate cs using System using System Collections Generic using System Text using System Data using System Data OleDb namespace VWMS CommonClass class DataOperate DataCon datacon new DataCon OleDbConnection oledbcon OleDbCommand oledbcom OleDbDataAdapter oledbda DataSet ds public void getCom string strCon oledbcon datacon getCon oledbcom new OleDbCommand strCon oledbcon oledbcon Open oledbcom ExecuteNonQuery oledbcon Close public DataSet getDs string strCon string tbname oledbcon datacon getCon oledbda new OleDbDataAdapter strCon oledbcon ds new DataSet oledbda Fill ds tbname return ds 9 PelcoD cs using System using System Collections Generic using System Text using System Collections namespace VWMS CommonClass class PelcoD private string watchdir 监控方向 private static readonly byte STX 0 xFF 同步字节 region 监控方向和定时监控实体 public string WatchDir get return watchdir set watchdir value endregion region 基本指令定义 region 指令码1 private const byte FocusNear 0 x01 增加聚焦 private const byte IrisOpen 0 x02 减小光圈 private const byte IrisClose 0 x04 增加光圈 private const byte CameraOnOff 0 x08 摄像机打开和关闭 private const byte AutoManualScan 0 x10 自动和手动扫描 private const byte Sense 0 x80 Sence码 endregion region 指令码2 private const byte PanRight 0 x02 右 private const byte PanLeft 0 x04 左 private const byte TiltUp 0 x08 上 private const byte TiltDown 0 x10 下 private const byte ZoomTele 0 x20 增加对焦 private const byte ZoomWide 0 x40 减小对焦 private const byte FocusFar 0 x80 减小聚焦 endregion region 镜头左右平移的速度 private const byte PanSpeedMin 0 x00 停止 private const byte PanSpeedMax 0 xFF 最高速 endregion region 镜头上下移动的速度 private const byte TiltSpeedMin 0 x00 停止 private const byte TiltSpeedMax 0 x3F 最高速 endregion endregion region 云台控制枚举 public enum Switch On 0 x01 Off 0 x02 雨刷控制 public enum Focus Near FocusNear Far FocusFar 聚焦控制 public enum Zoom Wide ZoomWide Tele ZoomTele 对焦控制 public enum Tilt Up TiltUp Down TiltDown 上下控制 public enum Pan Left PanLeft Right PanRight 左右控制 public enum Scan Auto Manual 自动和手动控制 public enum Iris Open IrisOpen Close IrisClose 光圈控制 endregion region 云台控制方法 雨刷控制 public byte CameraSwitch uint deviceAddress Switch action byte m action CameraOnOff if action Switch On m action CameraOnOff Sense return Message GetMessage deviceAddress m action 0 x00 0 x00 0 x00 光圈控制 public byte CameraIrisSwitch uint deviceAddress Iris action return Message
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 中国海洋大学2026年强基计划面试+体育测试模拟试题及答案解析二
- 陕西省西安市第九十八中学2026届中考物理仿真试卷含解析
- 山西省大同市第一中学2026届中考猜题物理试卷含解析
- 烧成危险源辨识及风险评价表
- 上海市普陀区名校2026届中考物理押题卷含解析
- 装配式构件施工方案
- 山西省晋中学市重点名校2026年中考物理模拟试题含解析
- 2026年广东省阳江市阳春八甲中学中考冲刺卷物理试题含解析
- 湖南省长沙市师大附中教育集团-重点达标名校2026届中考物理全真模拟试题含解析
- 2026届安徽省亳州市刘桥中学初中物理毕业考试模拟冲刺卷含解析
- 漂浮式海底锚桩施工方案
- 2025及未来5年中国镀银线市场调查、数据监测研究报告
- 新能源公司风电场电力企业应急能力建设评估自评报告
- 铸牢中华民族共同体课件
- DBJT15-140-2018 广东省市政基础设施工程施工安全管理标准
- 2025年贵阳市中考地理试卷(含答案解析)
- 混凝土胶凝材料化学降碳剂
- 21.1一元二次方程课件人教版九年级数学上册
- 防洪防汛隐患排查台账
- 医院财务岗笔试题及答案
- 合作交叉持股协议书
评论
0/150
提交评论