本文整理汇总了C++中IsBusy函数的典型用法代码示例。如果您正苦于以下问题:C++ IsBusy函数的具体用法?C++ IsBusy怎么用?C++ IsBusy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsBusy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetRangeAndBandwidth
/*******************************************************************************
Function: inline void SetRangeAndBandwidth(void)
*****************************************************************************/
inline void SetRangeAndBandwidth(uint8_t accl_range)
{
ACCEL_BMA250_REG reg;
uint16_t idx;
idx = ReadByteSequence(0, ACCEL_BMA250_ADDR14);
AccelRxBuffer = (uint8_t *)®
accelData[idx].cmd = ACCEL_DONE;
ACCELStartCommandSequence();
#ifndef ACCEL_USE_POLLING
while(IsBusy())
;
#else
while(ACCELTask() == ACCEL_VALID)
;
#endif
// reg.range = accl_range;
// reg.bandwidth = ACCEL_BMA250_BW_50;
// idx = WriteByteSequence(0, ACCEL_BMA250_ADDR14, reg.val);
idx = WriteByteSequence(0, ACCEL_BMA250_ADDR0F, accl_range);
// idx = WriteByteSequence(idx, ACCEL_BMA250_ADDR10, 0x08);
idx = WriteByteSequence(idx, ACCEL_BMA250_ADDR10, 0x0f); //0x0f, bandwidth 1000Hz, updata time 0.5ms
accelData[idx].cmd = ACCEL_DONE;
ACCELStartCommandSequence();
#ifndef ACCEL_USE_POLLING
while(IsBusy())
;
#else
while(ACCELTask() == ACCEL_VALID)
;
#endif
}
示例2: OnError
void CEMSocket::OnSend(int iErrorCode)
{
if (iErrorCode)
{
OnError(iErrorCode);
return;
}
// EMTrace("CEMSocket::OnSend linked: %i, controlcount %i, standardcount %i, isbusy: %i",m_bLinkedPackets, m_controlPacketQueue.GetCount(), m_standardPacketQueue.GetCount(), IsBusy());
if (m_eConnectionState == ES_DISCONNECTED)
return;
else
m_eConnectionState = ES_CONNECTED;
// If there's data left in the send buffer, continue sending
if (IsBusy())
Send(NULL, 0, 0);
// If there's _still_ data left...
if (IsBusy())
return;
while ((m_controlPacketQueue.GetHeadPosition() != NULL) && !IsBusy() && IsConnected() && !m_bLinkedPackets)
{
Packet *pPacket = m_controlPacketQueue.GetHead();
// EMTrace("CEMSocket::OnSend sending control packet on %d, size=%u",(SOCKET)this, pPacket->GetRealPacketSize());
Send(pPacket->DetachPacket(),pPacket->GetRealPacketSize());
m_controlPacketQueue.RemoveHead();
delete pPacket;
}
while ((m_standardPacketQueue.GetHeadPosition() != NULL) && !IsBusy() && IsConnected())
{
Packet *pPacket = m_standardPacketQueue.GetHead();
if (pPacket->IsLastSplit())
m_bLinkedPackets = false;
else if (pPacket->IsSplit())
m_bLinkedPackets = true;
else if (m_bLinkedPackets)
{
ASSERT(false);
}
// EMTrace("CEMSocket::OnSend sending standard packet on %d, size=%u",(SOCKET)this, pPacket->GetRealPacketSize());
Send(pPacket->DetachPacket(), pPacket->GetRealPacketSize());
m_standardPacketQueue.RemoveHead();
delete pPacket;
}
while ((m_controlPacketQueue.GetHeadPosition() != NULL) && !IsBusy() && IsConnected() && !m_bLinkedPackets)
{
Packet *pPacket = m_controlPacketQueue.GetHead();
// EMTrace("CEMSocket::OnSend sending control packet on %d, size=%u",(SOCKET)this, pPacket->GetRealPacketSize());
Send(pPacket->DetachPacket(), pPacket->GetRealPacketSize());
m_controlPacketQueue.RemoveHead();
delete pPacket;
}
}
示例3: MyAssert
// will url encode var and value.
void WebRequestObject::RequestAddPair(const char* var, int value)
{
MyAssert( IsBusy() == false );
if( IsBusy() )
return;
char valuestring[20];
sprintf_s( valuestring, 20, "%d", value );
RequestAddPair( var, valuestring );
//LOGInfo( LOGTag, "WebRequestObject - RequestAddPair %s\n", m_PageWanted );
}
示例4: ACCELTask
/*******************************************************************************
Function: ACCEL_RESULT ACCELTask(void)
*****************************************************************************/
ACCEL_RESULT ACCELTask(void)
{
if(IsBusy())
{
ACCEL_BMA250InterruptHandler();
// one last check to see if we are busy
if(IsBusy())
return ACCEL_VALID;
}
return ACCEL_INVALID;
}
示例5: SetThershold
/*******************************************************************************
Function: inline void SetThershold(void)
*****************************************************************************/
inline void SetThershold(void)
{
ACCEL_BMA250_REG reg;
uint16_t idx;
idx = ReadByteSequence(0, ACCEL_BMA250_ADDR11);
AccelRxBuffer = (uint8_t *)®
accelData[idx].cmd = ACCEL_DONE;
ACCELStartCommandSequence();
#ifndef ACCEL_USE_POLLING
while(IsBusy())
;
#else
while(ACCELTask() == ACCEL_VALID)
;
#endif
idx = WriteByteSequence(0, ACCEL_BMA250_ADDR14, ACCEL_BMA250_THES);
accelData[idx].cmd = ACCEL_DONE;
ACCELStartCommandSequence();
#ifndef ACCEL_USE_POLLING
while(IsBusy())
;
#else
while(ACCELTask() == ACCEL_VALID)
;
#endif
idx = ReadByteSequence(0, ACCEL_BMA250_ADDR11);
AccelRxBuffer = (uint8_t *)®
accelData[idx].cmd = ACCEL_DONE;
ACCELStartCommandSequence();
#ifndef ACCEL_USE_POLLING
while(IsBusy())
;
#else
while(ACCELTask() == ACCEL_VALID)
;
#endif
}
示例6: Rename
int CFileZillaApi::Rename(CString oldName, CString newName, const CServerPath &path /*=CServerPath()*/, const CServerPath &newPath /*=CServerPath()*/)
{
//Check if call allowed
if (!m_bInitialized)
return FZ_REPLY_NOTINITIALIZED;
if (IsConnected()==FZ_REPLY_NOTCONNECTED)
return FZ_REPLY_NOTCONNECTED;
if (IsBusy()==FZ_REPLY_BUSY)
return FZ_REPLY_BUSY;
if (oldName==_MPT("") || newName==_MPT(""))
return FZ_REPLY_INVALIDPARAM;
CServerPath path2 = path;
if (path2.IsEmpty())
{
m_pMainThread->GetCurrentPath(path2);
if (path2.IsEmpty())
return FZ_REPLY_INVALIDPARAM;
}
t_command command;
command.id = FZ_COMMAND_RENAME;
command.param1 = oldName;
command.param2 = newName;
command.path = path2;
command.newPath = newPath;
m_pMainThread->Command(command);
if (m_hOwnerWnd)
return FZ_REPLY_WOULDBLOCK;
else
return m_pMainThread->LastOperationSuccessful()?FZ_REPLY_OK:FZ_REPLY_ERROR;
return FZ_REPLY_ERROR;
}
示例7: CustomCommand
int CFileZillaApi::CustomCommand(CString CustomCommand)
{
//Check if call allowed
if (!m_bInitialized)
return FZ_REPLY_NOTINITIALIZED;
if (IsConnected()==FZ_REPLY_NOTCONNECTED)
return FZ_REPLY_NOTCONNECTED;
if (IsBusy()==FZ_REPLY_BUSY)
return FZ_REPLY_BUSY;
t_server server;
int res=GetCurrentServer(server);
if (res!=FZ_REPLY_OK)
return res;
#ifndef MPEXT_NO_SFTP
if (server.nServerType&FZ_SERVERTYPE_SUB_FTP_SFTP)
return FZ_REPLY_NOTSUPPORTED;
#endif
if (CustomCommand==_MPT(""))
return FZ_REPLY_INVALIDPARAM;
t_command command;
command.id=FZ_COMMAND_CUSTOMCOMMAND;
command.param1=CustomCommand;
m_pMainThread->Command(command);
if (m_hOwnerWnd)
return FZ_REPLY_WOULDBLOCK;
else
return m_pMainThread->LastOperationSuccessful()?FZ_REPLY_OK:FZ_REPLY_ERROR;
}
示例8: GetOffHandInfo
//---------------------------------------------------------
bool CWeapon::OnActionReload(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
if(activationMode==eAAM_OnPress)
{
COffHand * offHandWeapon = NULL;
bool isOffHandSelected = false;
GetOffHandInfo(this,isOffHandSelected,&offHandWeapon);
if (!IsBusy() && !m_modifying && !isOffHandSelected)
{
bool isDualWield = false;
CWeapon *dualWield = NULL;
GetDualWieldInfo(this,isDualWield,&dualWield);
if(IsWeaponRaised() && m_fm && m_fm->CanReload())
RaiseWeapon(false);
Reload();
if (isDualWield)
{
if(dualWield->IsWeaponRaised() && dualWield->CanReload())
dualWield->RaiseWeapon(false);
dualWield->Reload();
}
}
}
return true;
}
示例9: Execute
int CFileZillaEngine::Execute(const CCommand &command)
{
if (command.GetId() != Command::cancel && IsBusy())
return FZ_REPLY_BUSY;
m_bIsInCommand = true;
int res = FZ_REPLY_INTERNALERROR;
switch (command.GetId())
{
case Command::connect:
res = Connect(reinterpret_cast<const CConnectCommand &>(command));
break;
case Command::disconnect:
res = Disconnect(reinterpret_cast<const CDisconnectCommand &>(command));
break;
case Command::cancel:
res = Cancel(reinterpret_cast<const CCancelCommand &>(command));
break;
case Command::list:
res = List(reinterpret_cast<const CListCommand &>(command));
break;
case Command::transfer:
res = FileTransfer(reinterpret_cast<const CFileTransferCommand &>(command));
break;
case Command::raw:
res = RawCommand(reinterpret_cast<const CRawCommand&>(command));
break;
case Command::del:
res = Delete(reinterpret_cast<const CDeleteCommand&>(command));
break;
case Command::removedir:
res = RemoveDir(reinterpret_cast<const CRemoveDirCommand&>(command));
break;
case Command::mkdir:
res = Mkdir(reinterpret_cast<const CMkdirCommand&>(command));
break;
case Command::rename:
res = Rename(reinterpret_cast<const CRenameCommand&>(command));
break;
case Command::chmod:
res = Chmod(reinterpret_cast<const CChmodCommand&>(command));
break;
default:
return FZ_REPLY_SYNTAXERROR;
}
if (res != FZ_REPLY_WOULDBLOCK)
ResetOperation(res);
m_bIsInCommand = false;
if (command.GetId() != Command::disconnect)
res |= m_nControlSocketError;
else if (res & FZ_REPLY_DISCONNECTED)
res = FZ_REPLY_OK;
m_nControlSocketError = 0;
return res;
}
示例10: Connect
// Command handlers
int CFileZillaEnginePrivate::Connect(const CConnectCommand &command)
{
if (IsConnected())
return FZ_REPLY_ALREADYCONNECTED;
if (IsBusy())
return FZ_REPLY_BUSY;
m_retryCount = 0;
if (m_pControlSocket)
{
// Need to delete before setting m_pCurrentCommand.
// The destructor can call CFileZillaEnginePrivate::ResetOperation
// which would delete m_pCurrentCommand
delete m_pControlSocket;
m_pControlSocket = 0;
m_nControlSocketError = 0;
}
m_pCurrentCommand = command.Clone();
if (command.GetServer().GetPort() != CServer::GetDefaultPort(command.GetServer().GetProtocol()))
{
ServerProtocol protocol = CServer::GetProtocolFromPort(command.GetServer().GetPort(), true);
if (protocol != UNKNOWN && protocol != command.GetServer().GetProtocol())
m_pLogging->LogMessage(Status, _("Selected port usually in use by a different protocol."));
}
return ContinueConnect();
}
示例11: ACCELGetXYAxis
/*******************************************************************************
Function: ACCEL_RESULT ACCELGetXYAxis(ACCEL_DATA *acc_x, ACCEL_DATA *acc_y)
*****************************************************************************/
ACCEL_RESULT ACCELGetXYAxis(ACCEL_DATA *acc_x, ACCEL_DATA *acc_y)
{
if(IsBusy())
return ACCEL_INVALID;
if((accelXYZData.acc_x_lsb.new_data_x) && (accelXYZData.acc_y_lsb.new_data_y))
{
uint32_t data;
uint8_t size = 0;
if(ACCEL_BMA250_AXIS_BIT > (sizeof(ACCEL_DATA) * 8))
size = (uint8_t)(ACCEL_BMA250_AXIS_BIT - (sizeof(ACCEL_DATA) * 8));
data = (uint32_t)accelXYZData.acc_x_msb.val << 8;
data |= (uint32_t)accelXYZData.acc_x_lsb.val;
data >>= 6;
*acc_x = (ACCEL_DATA)(data >> size) ;
data = (uint32_t)accelXYZData.acc_y_msb.val << 8;
data |= (uint32_t)accelXYZData.acc_y_lsb.val;
data >>= 6;
*acc_y = (ACCEL_DATA)(data >> size);
accelXYZData.acc_x_lsb.new_data_x = 0;
accelXYZData.acc_y_lsb.new_data_y = 0;
accelXYZData.acc_z_lsb.new_data_z = 0;
return ACCEL_VALID;
}
示例12: if
//---------------------------------------------------------
bool CWeapon::OnActionReload(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
bool playerCanStartReload = false;
if (activationMode == eAAM_OnPress && (CheckPickupInteraction(this) == false))
playerCanStartReload = true;
// this condition results from the interaction between reload and item pickups. If on front on an item and press reload/pick button but not for long enought,
// then the player should still reload the weapon instead of picking up the item.
else if(activationMode == eAAM_OnRelease && CheckPickupInteraction(this) == true)
playerCanStartReload = true;
float currentTime = gEnv->pTimer->GetCurrTime();
if (!playerCanStartReload && activationMode == eAAM_OnPress)
m_reloadButtonTimeStamp = currentTime;
else if (activationMode == eAAM_OnRelease && playerCanStartReload && currentTime > m_reloadButtonTimeStamp+g_pGameCVars->pl_useItemHoldTime)
playerCanStartReload = false;
if (!playerCanStartReload)
return true;
if (!IsBusy() && !AreAnyItemFlagsSet(eIF_Modifying))
{
ReloadWeapon();
}
else if (!IsReloading() && activationMode == eAAM_OnPress)
{
SetInputFlag(eWeaponAction_Reload);
}
return true;
}
示例13: Cancel
int CFileZillaEnginePrivate::Cancel(const CCancelCommand &command)
{
if (!IsBusy())
return FZ_REPLY_OK;
if (m_retryTimer.IsRunning())
{
wxASSERT(m_pCurrentCommand && m_pCurrentCommand->GetId() == cmd_connect);
delete m_pControlSocket;
m_pControlSocket = 0;
delete m_pCurrentCommand;
m_pCurrentCommand = 0;
m_retryTimer.Stop();
m_pLogging->LogMessage(::Error, _("Connection attempt interrupted by user"));
COperationNotification *notification = new COperationNotification();
notification->nReplyCode = FZ_REPLY_DISCONNECTED|FZ_REPLY_CANCELED;
notification->commandId = cmd_connect;
AddNotification(notification);
return FZ_REPLY_WOULDBLOCK;
}
SendEvent(engineCancel);
return FZ_REPLY_WOULDBLOCK;
}
示例14: while
//------------------------------------------------------------------------------
void
OMAPDDGPE::WaitForNotBusy()
{
// Wait for any active DMA operation to complete
while( IsBusy() );
return;
}
示例15: CRY_ASSERT_MESSAGE
//-----------------------------------------------------------------------
void CSpectacularKill::End(bool bKillerDied/* = false*/)
{
CRY_ASSERT_MESSAGE(IsBusy(), "spectacular kill cannot be stopped if it is not in progress");
if (!IsBusy())
return;
ICooperativeAnimationManager* pCooperativeAnimationManager = gEnv->pGame->GetIGameFramework()->GetICooperativeAnimationManager();
CActor* pTarget = GetTarget();
CRY_ASSERT(pTarget);
if(pTarget)
{
pCooperativeAnimationManager->StopCooperativeAnimationOnActor(m_pOwner->GetAnimatedCharacter(), pTarget->GetAnimatedCharacter());
// Enable AI again (for what it's worth - this helps editor)
if (!pTarget->IsPlayer() && pTarget->GetEntity()->GetAI())
pTarget->GetEntity()->GetAI()->Event(AIEVENT_ENABLE, 0);
if (bKillerDied && (m_deathBlowState == eDBS_None) && static_cast<CPlayer*> (pTarget)->CanFall())
{
// Enable Fall n Play on target if killer dies before death blowing it
pTarget->Fall();
}
else if (m_deathBlowState != eDBS_Done)
{
DeathBlow(*pTarget); // Call this in case the notification from the animation system got skipped or missed for some reason
}
SActorStats* pTargetStats = pTarget->GetActorStats();
pTargetStats->spectacularKillPartner = 0;
}
else
{
pCooperativeAnimationManager->StopCooperativeAnimationOnActor(m_pOwner->GetAnimatedCharacter());
}
// Enable AI again (for what it's worth - this helps editor)
if (m_pOwner && m_pOwner->GetEntity()->GetAI())
m_pOwner->GetEntity()->GetAI()->Event(AIEVENT_ENABLE, 0);
ClearState();
assert(m_pOwner);
SActorStats* pStats = m_pOwner->GetActorStats();
if(pStats)
pStats->spectacularKillPartner = 0;
}