コード例 #1
0
void keyprocess()
{
 switch(key_code)
 	{
	 case 'A':
	 			process_a();
				break;

	 case 'B' :
	 			process_b();
				break;
	 case 'C' :
	 			process_c();
				break;
	}
	key_release();
}
コード例 #2
0
ファイル: wb_wsx.cpp プロジェクト: ManfredHerrmann/proview
pwr_tStatus wsx_CheckIoDevice( 
	ldh_tSesContext	sesctx,
	pwr_tAttrRef	aref,
	int		*errorcount,
	int		*warningcount,
	wsx_mCardOption options
)
{
  wb_session *sp = (wb_session *)sesctx;
  pwr_tMask process;
  pwr_tOid thread;

  wb_attribute a = sp->attribute( &aref);
  if ( !a) return a.sts();

  // Check Process
  wb_attribute process_a( a, 0, "Process");
  if ( !process_a) return process_a.sts();
    
  process_a.value( &process);
  if ( !process_a) return process_a.sts();
  if ( process == 0)
    wsx_error_msg_str( sesctx, "Process is not specified", aref, 'W', errorcount, warningcount);
  else if ( process == 1) {

    // Check thread object
    wb_attribute thread_a( a, 0, "ThreadObject");
    if ( !thread_a) return thread_a.sts();
    
    thread_a.value( &thread);
    if ( !thread_a) return thread_a.sts();
    if ( cdh_ObjidIsNull( thread))
      wsx_error_msg_str( sesctx, "ThreadObject is not specified", aref, 'E', errorcount, warningcount);
    else {
      wb_object thread_o = sp->object( thread);
      if ( !thread_o)
	wsx_error_msg_str( sesctx, "Undefined ThreadObject", aref, 'E', errorcount, warningcount);
      else if ( thread_o.cid() != pwr_cClass_PlcThread)
	wsx_error_msg_str( sesctx, "Error in ThreadObject class", aref, 'E', errorcount, warningcount);
    }
  }

  if ( options & wsx_mCardOption_ErrorLimits) {
    pwr_tUInt32 limit;

    // Check SoftLimit
    wb_attribute softlimit_a( a, 0, "ErrorSoftLimit");
    if ( !softlimit_a) return softlimit_a.sts();
    
    softlimit_a.value( &limit);
    if ( !softlimit_a) return softlimit_a.sts();
    if ( limit == 0)
      wsx_error_msg_str( sesctx, "ErrorSoftLimit is not specified", aref, 'W', errorcount, warningcount);

    // Check HardLimit
    wb_attribute hardlimit_a( a, 0, "ErrorHardLimit");
    if ( !hardlimit_a) return hardlimit_a.sts();
    
    hardlimit_a.value( &limit);
    if ( !hardlimit_a) return hardlimit_a.sts();
    if ( limit == 0)
      wsx_error_msg_str( sesctx, "ErrorHardLimit is not specified", aref, 'E', errorcount, warningcount);

  }
  return WSX__SUCCESS;
}