本文整理汇总了C++中Communication::Request方法的典型用法代码示例。如果您正苦于以下问题:C++ Communication::Request方法的具体用法?C++ Communication::Request怎么用?C++ Communication::Request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Communication
的用法示例。
在下文中一共展示了Communication::Request方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
init_sys_var(argc, argv);
init_local_resource();
init_matrix_addr_book();
MCCKeyboardManager manager;
Communication comm;
manager.Start();
comm.Start();
manager.LoadKeyboard("generic","/dev/ttyUSB0", "/dev/ttyUSB1", 9600, 8, 1, 'n', 0);
cout<<"load keyboard done"<<endl;
while(1)
{
int cid, mid, moid, uid;
cout<<"matrix id:";
cin>>mid;
cout<<"camera id:";
cin>>cid;
cout<<"monitor id:";
cin>>moid;
cout<<"user id:";
cin>>uid;
User user(uid, mid);
if(moid > max_mon || moid < min_mon )
{
cout<<"monitor dosen't exist!"<<endl;
continue;
}
else if(mon[moid].id > uid && !isExpired(mon[moid]))
{
cout<<"monitor is busy"<<endl;
continue;
}
else
cout<<"monitor is avialble!"<<endl;
if(mid == local_matrix_id && cam[cid] <= user){
cam[cid] = user;
cout<<"camera is aviable!"<<endl;
}
else if(mid != local_matrix_id && comm.Request(mid, cid, uid) == 0){
cout<<"camera is aviable!"<<endl;
}
else{
cout<<"camera is not aviable!"<<endl;
continue;
}
mon[moid] = User(uid, local_matrix_id);
};
manager.UnloadKeyboard(0);
comm.Stop();
manager.Stop();
return 0;
}