本文整理汇总了C++中PrintStatus函数的典型用法代码示例。如果您正苦于以下问题:C++ PrintStatus函数的具体用法?C++ PrintStatus怎么用?C++ PrintStatus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PrintStatus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DB
void Socket::setBlockingMode(bool isBlocking) {
#ifndef _WIN32
DB(PrintStatus(fd));
if (!_myIsConnected) {
AC_WARNING << "Socket::setBlockingMode setting blocking mode of a not connected socket, the mode will be lost after you connect";
}
int status = fcntl(fd, F_GETFL, 0);
if (!isBlocking) {
status |= O_NONBLOCK;
} else {
status &= ~O_NONBLOCK;
}
if (fcntl(fd, F_SETFL, status)== -1) {
throw SocketError(getLastSocketError(), "Socket::setBlockingMode failed");
}
#else
u_long theFlag = 1;
if (isBlocking) {
theFlag = 0;
}
int theRC = ioctlsocket(fd, FIONBIO, &theFlag);
if (theRC == SOCKET_ERROR) {
int err = getLastSocketError();
throw SocketError(err, "Socket::setBlockingMode failed");
}
#endif
}
示例2: VS_ParseCommand
uint8_t VS_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io)
{
const uint8_t *p;
uint32_t val32u;
if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "VS1053 help")==0) {
*handled = TRUE;
return PrintHelp(io);
} else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "VS1053 status")==0)) {
*handled = TRUE;
return PrintStatus(io);
} else if (UTIL1_strncmp((char*)cmd, "VS1053 volume ", sizeof("VS1053 volume ")-1)==0) {
*handled = TRUE;
p = cmd+sizeof("VS1053 volume ")-1;
if (UTIL1_xatoi(&p, &val32u)==ERR_OK) {
return VS_SetVolume((uint16_t)val32u);
} else {
CLS1_SendStr("Failed reading volume", io->stdErr);
return ERR_FAILED;
}
} else if (UTIL1_strncmp((char*)cmd, "VS1053 play ", sizeof("VS1053 play ")-1)==0) {
*handled = TRUE;
p = cmd+sizeof("VS1053 play ")-1;
return VS_PlaySong(p, io);
}
return ERR_OK;
}
示例3: REF_ParseCommand
byte REF_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "ref help")==0) {
*handled = TRUE;
return PrintHelp(io);
} else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "ref status")==0)) {
*handled = TRUE;
return PrintStatus(io);
#if REF_START_STOP_CALIB
} else if (UTIL1_strcmp((char*)cmd, "ref calib start")==0) {
if (refState==REF_STATE_NOT_CALIBRATED || refState==REF_STATE_READY) {
REF_CalibrateStartStop();
} else {
CLS1_SendStr((unsigned char*)"ERROR: cannot start calibration, must not be calibrating or be ready.\r\n", io->stdErr);
return ERR_FAILED;
}
*handled = TRUE;
return ERR_OK;
} else if (UTIL1_strcmp((char*)cmd, "ref calib stop")==0) {
if (refState==REF_STATE_CALIBRATING) {
REF_CalibrateStartStop();
} else {
CLS1_SendStr((unsigned char*)"ERROR: can only stop if calibrating.\r\n", io->stdErr);
return ERR_FAILED;
}
*handled = TRUE;
return ERR_OK;
#endif
}
return ERR_OK;
}
示例4: PrintStatus
std::ostream& AztecOO_StatusTestResNorm::Print(std::ostream& stream, int indent) const
{
for (int j = 0; j < indent; j ++)
stream << ' ';
PrintStatus(stream, status_);
stream << "(";
if (resweights_!=0) stream << "Weighted ";
stream << ((resnormtype_==OneNorm) ? "1-Norm" : (resnormtype_==TwoNorm) ? "2-Norm" : "Inf-Norm");
stream << ((curresvecexplicit_) ? " Exp" : " Imp");
stream << " Res Vec) ";
if (scaletype_!=None)
stream << "/";
if (scaletype_==UserProvided)
stream << " (User Scale)";
else {
stream << "(";
if (scaleweights_!=0) stream << "Weighted ";
stream << ((scalenormtype_==OneNorm) ? "1-Norm" : (resnormtype_==TwoNorm) ? "2-Norm" : "Inf-Norm");
if (scaletype_==NormOfInitRes)
stream << " Res0";
else
stream << " RHS ";
stream << ")";
}
if (status_==Unchecked)
stream << " Unchecked << ";
else {
stream << " = " << testvalue_;
stream << ((testvalue_<tolerance_) ? " < " : (testvalue_==tolerance_) ? " = " : (testvalue_>tolerance_) ? " > " : " <> ");
}
stream << tolerance_;
stream << std::endl;
return stream;
}
示例5: LP_ParseCommand
uint8_t LP_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, (char*)"LowPower help")==0) {
PrintHelp(io);
*handled = TRUE;
} else if (UTIL1_strcmp((char*)cmd, (char*)CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, (char*)"LowPower status")==0) {
PrintStatus(io);
*handled = TRUE;
} else if (UTIL1_strcmp((char*)cmd, (char*)"LowPower mode run")==0) {
*handled = TRUE;
LP_mode = LP_RUN;
} else if (UTIL1_strcmp((char*)cmd, (char*)"LowPower mode wait")==0) {
*handled = TRUE;
LP_mode = LP_WAIT;
} else if (UTIL1_strcmp((char*)cmd, (char*)"LowPower mode sleep")==0) {
*handled = TRUE;
LP_mode = LP_SLEEP;
} else if (UTIL1_strcmp((char*)cmd, (char*)"LowPower mode stop")==0) {
*handled = TRUE;
LP_mode = LP_STOP;
#if LP_CAN_CHANGE_CLOCK
} else if (UTIL1_strcmp((char*)cmd, (char*)"LowPower clock fast")==0) {
*handled = TRUE;
LP_ChangeClock(LP_SPEED_FAST);
} else if (UTIL1_strcmp((char*)cmd, (char*)"LowPower clock medium")==0) {
*handled = TRUE;
LP_ChangeClock(LP_SPEED_MEDIUM);
} else if (UTIL1_strcmp((char*)cmd, (char*)"LowPower clock slow")==0) {
*handled = TRUE;
LP_ChangeClock(LP_SPEED_SLOW);
#endif
}
return ERR_OK;
}
示例6: DeletePartitions
/* Delete the disk partition table */
BOOL DeletePartitions(HANDLE hDrive)
{
BOOL r;
DWORD size;
CREATE_DISK CreateDisk = {PARTITION_STYLE_RAW, {{0}}};
PrintStatus(0, TRUE, "Deleting partitions...");
size = sizeof(CreateDisk);
r = DeviceIoControl(hDrive, IOCTL_DISK_CREATE_DISK,
(BYTE*)&CreateDisk, size, NULL, 0, &size, NULL );
if (!r) {
uprintf("Could not delete drive layout: %s\n", WindowsErrorString());
safe_closehandle(hDrive);
return FALSE;
}
r = DeviceIoControl(hDrive, IOCTL_DISK_UPDATE_PROPERTIES, NULL, 0, NULL, 0, &size, NULL );
if (!r) {
uprintf("Could not refresh drive layout: %s\n", WindowsErrorString());
safe_closehandle(hDrive);
return FALSE;
}
return TRUE;
}
示例7: Init
void Init( void ) {
RegisterCommands();
RegisterCvars();
isServer = Common::com_dedicated->GetBool();
peer = RakNet::RakPeerInterface::GetInstance();
uint16_t port = static_cast<uint16_t>( net_port->GetInt32() );
RakNet::SocketDescriptor socketDescriptors[] = {
RakNet::SocketDescriptor( port, nullptr ) // primary network card
};
if ( isServer ) {
maxConnections = Server::sv_maxConnections->GetUInt32();
}
else {
maxConnections = 1u;
}
peer->Startup( maxConnections, socketDescriptors, ARRAY_LEN( socketDescriptors ) );
peer->SetMaximumIncomingConnections( maxConnections );
// peer->SetOccasionalPing( true );
peer->SetUnreliableTimeout( 1000 );
peer->AllowConnectionResponseIPMigration( false );
myGUID = peer->GetGuidFromSystemAddress( RakNet::UNASSIGNED_SYSTEM_ADDRESS ).g;
PrintStatus();
}
示例8: MPC4728_ParseCommand
byte MPC4728_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
const unsigned char *p;
if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "MPC4728 help")==0) {
*handled = TRUE;
return PrintHelp(io);
} else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "MPC4728 status")==0)) {
*handled = TRUE;
return PrintStatus(io);
} else if (UTIL1_strcmp((char*)cmd, "MPC4728 reset")==0) {
*handled = TRUE;
if (MPC4728_Reset()!=ERR_OK) {
return ERR_FAILED;
} else {
return ERR_OK;
}
} else if (UTIL1_strcmp((char*)cmd, "MPC4728 wakeup")==0) {
*handled = TRUE;
if (MPC4728_Wakeup()!=ERR_OK) {
return ERR_FAILED;
} else {
return ERR_OK;
}
} else if (UTIL1_strcmp((char*)cmd, "MPC4728 update")==0) {
*handled = TRUE;
if (MPC4728_Update()!=ERR_OK) {
return ERR_FAILED;
} else {
return ERR_OK;
}
} else if (UTIL1_strncmp((char*)cmd, "MPC4728 fastwrite ", sizeof("MPC4728 fastwrite ")-1)==0) {
uint16_t dac[4];
uint8_t pd[4];
int i;
*handled = TRUE;
p = cmd+sizeof("I2CSPY1 fastwrite ")-1;
for(i=0;i<4;i++) { /* init */
dac[i] = 0;
pd[i] = 0;
}
for(i=0;i<4;i++) {
if (UTIL1_ScanHex16uNumber(&p, &dac[i])!=ERR_OK) {
break;
}
dac[i] &= 0xFFF; /* ensure it is 12 bits */
}
if (i!=4) {
CLS1_SendStr((unsigned char*)"**** Not enough values, 4 expected.\r\n", io->stdErr);
return ERR_FAILED;
}
if (MPC4728_FastWrite(dac, sizeof(dac), pd, sizeof(pd))!=ERR_OK) {
CLS1_SendStr((unsigned char*)"**** FastWrite failed.\r\n", io->stdErr);
return ERR_FAILED;
} else {
return ERR_OK;
}
}
return ERR_OK;
}
示例9: FreeData
void LoggableFrontend::Update()
{
if (!PrepareData())
{
FreeData();
return;
}
BeforePrint();
MessageList* pMessages = LockMessages();
if (!pMessages->empty())
{
Message* pFirstMessage = pMessages->front();
int iStart = m_iNeededLogFirstID - pFirstMessage->GetID() + 1;
if (iStart < 0)
{
PrintSkip();
iStart = 0;
}
for (unsigned int i = (unsigned int)iStart; i < pMessages->size(); i++)
{
PrintMessage((*pMessages)[i]);
m_iNeededLogFirstID = (*pMessages)[i]->GetID();
}
}
UnlockMessages();
PrintStatus();
FreeData();
fflush(stdout);
}
示例10: MPI_Comm_free
//=============================================================================
void Amesos_Mumps::Destroy()
{
if (!NoDestroy_)
{
// destroy instance of the package
MDS.job = -2;
if (Comm().MyPID() < MaxProcs_) dmumps_c(&(MDS));
#if 0
if (IsComputeSchurComplementOK_ && (Comm().MyPID() == 0)
&& MDS.schur) {
delete [] MDS.schur;
MDS.schur = 0;
}
#endif
#ifdef HAVE_MPI
if (MUMPSComm_)
{
MPI_Comm_free( &MUMPSComm_ );
MUMPSComm_ = 0;
}
#endif
if( (verbose_ && PrintTiming_) || verbose_ == 2) PrintTiming();
if( (verbose_ && PrintStatus_) || verbose_ == 2) PrintStatus();
}
}
示例11: main
int main(int argc, const char * argv[]) {
if (argc != 2)
{
puts("Usage: toy FILE.brick\n");
return 0;
}
FILE* file = fopen(argv[1], "r");
if (!file)
{
printf("ERROR: cannot read file \"%s\".", argv[1]);
return (EXIT_FAILURE);
}
size_t file_size = getFileSize(file);
TOYVM vm;
InitializeVM(&vm, 2 * file_size, file_size);
fread(vm.memory, 1, file_size, file);
fclose(file);
RunVM(&vm);
if (vm.cpu.status.BAD_ACCESS
|| vm.cpu.status.BAD_INSTRUCTION
|| vm.cpu.status.INVALID_REGISTER_INDEX
|| vm.cpu.status.STACK_OVERFLOW
|| vm.cpu.status.STACK_UNDERFLOW)
{
PrintStatus(&vm);
}
}
示例12: QUADCALIB_ParseCommand
byte QUADCALIB_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "quadcalib help")==0) {
*handled = TRUE;
return PrintHelp(io);
} else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "quadcalib status")==0)) {
*handled = TRUE;
return PrintStatus(io);
} else if ((UTIL1_strcmp((char*)cmd, "quadcalib tune 0")==0)) {
*handled = TRUE;
return Tune(io, 0, MOT_GetMotorHandle(MOT_MOTOR_RIGHT));
} else if ((UTIL1_strcmp((char*)cmd, "quadcalib tune 1")==0)) {
*handled = TRUE;
return Tune(io, 1, MOT_GetMotorHandle(MOT_MOTOR_RIGHT));
} else if ((UTIL1_strcmp((char*)cmd, "quadcalib tune 2")==0)) {
*handled = TRUE;
return Tune(io, 2, MOT_GetMotorHandle(MOT_MOTOR_LEFT));
} else if ((UTIL1_strcmp((char*)cmd, "quadcalib tune 3")==0)) {
*handled = TRUE;
return Tune(io, 3, MOT_GetMotorHandle(MOT_MOTOR_LEFT));
}
return ERR_OK;
}
示例13: OnAlert
virtual void PXCAPI OnAlert(const PXCSpeechRecognition::AlertData *data) {
if(data->label == PXCSpeechRecognition::AlertType::ALERT_SPEECH_UNRECOGNIZABLE)
{
ClearScores(m_hWnd);
}
PrintStatus(m_hWnd,AlertToString(data->label));
}
示例14: EvaluateStatus
void EvaluateStatus(unsigned char force)
{
unsigned char T=0;
//calculating the state value
// input pins
if (!(PINA & 0b00000100)) T = T + 128;
if (!(PINA & 0b00000010)) T = T + 64;
if (!(PINA & 0b00000001)) T = T + 32;
if (!(PIND & 0b00000100)) T = T + 16;
// output relays
if ((PINB & 0b00000001)) T = T + 8;
if ((PINB & 0b00000010)) T = T + 4;
if ((PINB & 0b00000100)) T = T + 2;
if ((PINB & 0b00001000)) T = T + 1;
// if the force flag is set or the value has
// changed from the last known state, then
// update the last known state tracking
// variable and print the updated state
// to the serial connection
if(force || lastKnownInputState != T)
{
lastKnownInputState = T;
PrintStatus(T);
}
lastKnownInputState = T;
}
示例15: BLEUART_CMDMODE_ParseCommand
uint8_t BLEUART_CMDMODE_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
uint8_t res = ERR_OK;
if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "uart help")==0) {
CLS1_SendHelpStr((unsigned char*)"uart", (const unsigned char*)"Group of Adafruit BLE commands\r\n", io->stdOut);
CLS1_SendHelpStr((unsigned char*)" help|status", (const unsigned char*)"Print help or status information\r\n", io->stdOut);
CLS1_SendHelpStr((unsigned char*)" enable", (unsigned char*)"Enable BLE UART\r\n", io->stdOut);
CLS1_SendHelpStr((unsigned char*)" disable", (unsigned char*)"Disable BLE UART\r\n", io->stdOut);
CLS1_SendHelpStr((unsigned char*)" tx <string>", (unsigned char*)"Send string\r\n", io->stdOut);
*handled = TRUE;
return ERR_OK;
} else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "uart status")==0)) {
*handled = TRUE;
return PrintStatus(io);
} else if (UTIL1_strcmp((char*)cmd, "uart enable")==0) {
isEnabled = TRUE;
*handled = TRUE;
} else if (UTIL1_strcmp((char*)cmd, "uart disable")==0) {
isEnabled = FALSE;
*handled = TRUE;
} else if (UTIL1_strncmp((char*)cmd, "uart tx ", sizeof("uart tx ") - 1) == 0) {
*handled = TRUE;
taskENTER_CRITICAL();
UTIL1_strcpy(txBuffer, sizeof(txBuffer), cmd+sizeof("uart tx ")-1);
UTIL1_strcat(txBuffer, sizeof(txBuffer), "\\n\n"); /* add newline */
taskEXIT_CRITICAL();
}
return res; /* no error */
}