智能家居系统 源代码


智能家居系统 源代码,这是一份很不错的学习代码,希望可以帮助学习的人哦!
资源截图
代码片段和文件信息
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include “pthread.h“

#include “SockMsgFormat.h“
#include “MachineMajor.h“
#include “VideoCapture.h“

#define ADC_DEV          “/dev/adc/0raw“
#define DCM_DEV          “/dev/dcm/0raw“
#define STEP_DEV         “/dev/exio/0raw“
#define DCM_IOCTRL_SETPWM           0x10
#define DCM_TCNTB0       16384
#define STEPMOTOR_IOCTRL_PHASE      0x13
#define SERVPORT 2312
#define MAXBUFSIZE 100
#define BACKLOG 20
#define MAXTHREAD 10

//define the scope of temperature and humidity
#define MAX_TEMPERATURE          38
#define MIN_TEMPERATURE          18
#define MAX_HUMIDITY             80
#define MIN_HUMIDITY             20

#define MAX_ROBOTSTEP            50
#define MIN_ROBOTSTEP            1

//define the default system configure
#define AUTOPEN_AIRCONDITION     1
#define AUTOPEN_HUMICONDITION    1
#define DEFAULT_TEMPERATURE      38
#define DEFAULT_HUMIDITY         35
#define DEFAULT_ROBOTSTEP        5
#define DEFAULT_ROBOTCENTERX     320
#define DEFAULT_ROBOTCENTERY     240
#define DEFAULT_ROBOTDIRECTION   0
#define DEFAULT_SPEED            100

struct CurrentParam
{
bool door_state;
bool aircon_state;
bool cooker_state;
bool humi_state;
int  temperature;
int  humidity;
int  speed;
};

struct SystemConfigure
{
bool autopen_aircondition;
bool autopen_humicondition;
int default_temperature;
int default_humidity;
int default_robotstep;
int default_robotcenterX;
int default_robotcenterY;
int default_robotdirection;
int default_speed;
};

struct CurrentParam current;
struct SystemConfigure config;

int dcm_fd = -1;
int step_fd = -1;
int button = 1;
int distan_angle;
bool bexit = false;
int UpOrdown = 1;
int factor = DCM_TCNTB0/1024;

MachineMajordomo * robot = NULL;

pthread_t aircondition_th;
pthread_t humidity_th;
pthread_t vcapture_th;
pthread_t vsend_th;
void * retval;

int thread_count = 0;
pthread_mutex_t count_mutex;
pthread_mutex_t current_mutex;
pthread_mutex_t config_mutex;
pthread_mutex_t humi_mutex;

void SetDefaultConfig()
{
config.autopen_aircondition   = AUTOPEN_AIRCONDITION;
config.autopen_humicondition  = AUTOPEN_HUMICONDITION;
config.default_temperature     = DEFAULT_TEMPERATURE;
config.default_humidity       = DEFAULT_HUMIDITY;
config.default_robotstep      = DEFAULT_ROBOTSTEP;
config.default_robotcenterX   = DEFAULT_ROBOTCENTERX;
config.default_robotcenterY   = DEFAULT_ROBOTCENTERY;
config.default_robotdirection = DEFAULT_ROBOTDIRECTION;
config.default_speed          = DEFAULT_SPEED;
}

void WriteDefFile(FILE * fp)
{
if (fp == NULL)
return;

int d[12] = {AUTOPEN_AIRCONDITION AUTOPEN_HUMICONDITION 333 DEFAULT_TEMPERATURE DEFAULT_HUMIDITY DEFAULT_ROBOTSTEP 444DEFAULT_ROBOTCENTERX DEFAULT_ROBOTCENTERY 555 DEFAULT_ROBOTDIRECTION DEFAULT_SP

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......      3176  2008-08-15 23:10  codearm开发板端intelligence_homedriversdc-motor.o

    .......      4852  2008-08-15 23:10  codearm开发板端intelligence_homedriversexio.o

    .......    107296  2008-08-16 14:01  codearm开发板端intelligence_homedriversov511.o

    .......      3632  2008-08-15 23:10  codearm开发板端intelligence_homedriverss3c2410-adc.o

    .......     10780  2008-08-16 16:24  codearm开发板端intelligence_homedriversvideodev.o

    .......     29730  2008-08-15 23:10  codearm开发板端intelligence_homegrabencoder.c

    .......      3903  2008-08-15 23:10  codearm开发板端intelligence_homegrabencoder.h

    .......     15286  2008-08-15 23:10  codearm开发板端intelligence_homegrabhuffman.c

    .......      1885  2008-08-15 23:10  codearm开发板端intelligence_homegrabhuffman.h

    .......       199  2008-08-15 23:10  codearm开发板端intelligence_homegrabjdatatype.h

    .......      6989  2008-08-15 23:10  codearm开发板端intelligence_homegrabmarker.c

    .......      1908  2008-08-15 23:10  codearm开发板端intelligence_homegrabmarker.h

    .......      4413  2008-08-15 23:10  codearm开发板端intelligence_homegrabquant.c

    .......      1866  2008-08-15 23:10  codearm开发板端intelligence_homegrabquant.h

    .......     26966  2008-08-15 23:10  codearm开发板端intelligence_homegrabutils.c

    .......      3458  2008-08-15 23:10  codearm开发板端intelligence_homegrabutils.h

    .......        48  2008-08-30 20:44  codearm开发板端intelligence_homeinformation.dat

    .......    112697  2007-12-09 21:04  codearm开发板端intelligence_homeintellect_home

    .......     27378  2007-12-09 21:01  codearm开发板端intelligence_homeintellect_home.cpp

    .......   1247880  2001-02-10 14:22  codearm开发板端intelligence_homelibc++libstdc++-3-libc6.1-2-2.10.0.so

    .......     10944  2007-12-09 17:44  codearm开发板端intelligence_homeMachineMajor.cpp

    .......      2370  2007-12-09 17:36  codearm开发板端intelligence_homeMachineMajor.h

    .......       361  2008-08-21 05:51  codearm开发板端intelligence_homeMakefile

    .......      8079  2008-08-29 15:37  codearm开发板端intelligence_homeMyV4L.cpp

    .......      1814  2008-08-17 21:10  codearm开发板端intelligence_homeMyV4L.h

    .......      7334  2008-08-21 16:33  codearm开发板端intelligence_homeSockMsgFormat.cpp

    .......      1873  2008-08-20 22:54  codearm开发板端intelligence_homeSockMsgFormat.h

    .......       164  2008-08-30 18:50  codearm开发板端intelligence_homestartup

    .......      3105  2008-08-26 21:05  codearm开发板端intelligence_homeVideoCapture.cpp

    .......       251  2008-08-16 15:30  codearm开发板端intelligence_homeVideoCapture.h

............此处省略214个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)