コード例 #1
0
ファイル: devicev4l2base.C プロジェクト: Cuchulain/cinelerra
int DeviceV4L2Base::open_dev(int color_model)
{
	v4l2_lock->lock("DeviceV4L2Base::open_dev");
	int result = 0;
	if( !opened )
	{
		result = dev_open();
		if( !result )
			result = v4l2_open(color_model);
		if( !result )
			result = start_dev();
		if( !result )
		{
			qbfrs_lock->reset();
			video_lock->reset();
			getq = new DeviceV4L2BufferQ(total_buffers+1);
			put_thread = new DeviceV4L2Put(this);
			put_thread->start();
			done = 0;
			Thread::start();
		}
		else
			printf("DeviceV4L2Base::open_dev failed\n");
	}
	if( result )
	{
		printf("DeviceV4L2Base::open_dev: adaptor open failed\n");
		stop_dev();
		dev_close();
	}
	else
		opened = 1;
	v4l2_lock->unlock();
	return result;
}
コード例 #2
0
ファイル: protocol.c プロジェクト: cuu/weiyi
void ser_process(uint8*buf,uint8 read_len) // read_len is the length of buf, keep in range,max 255
{
  
        if(buf[0] == 0x01 && buf[1] == 0xa7) // 中讯威易
        {
            start_dev();
        }
        
        if(buf[1] == 0x01) // 对单个或多个设备(灯光、电器、红外、烟感、门磁等)进行开关或状态查询。
        {
          dev_opera( &buf[1]);
        }
        
        if(buf[1] == 0x81) // 上面指令的返回
        {
            opera_return( &buf[1]);          
        }
        
        if(buf[1] == 0x82) // 调光设备的返回  07 82 XX XX   dim1    dim2   dim3   dim4
        {
          dim_return( &buf[1]);
        }
        
        if(buf[1] == 0x06) // pcbus
        {
          //plcbus(&buf[1]);
        }
        
        if(buf[1] == 0xa8) // 重启 zigbee 模块  0x02 0xa8 0x??
        {
          reboot_zigbee(&buf[1]);
        }
        if(buf[1] == 0x08)
        {
          pda_to_gateway(buf);
        }
        
        if(buf[1] == 0xa9) // 高分贝报警器报警
        {
          hd_alarm(&buf[1]);
        }
        
        if(buf[1] == 0x89) // check it node is alive
        {
          check_alive();
        }
        
        if(buf[1] == 0xb0) //场景面板的编号设置
        {
          profile_panel_number_set(buf);
        }
}