本文整理汇总了C++中DEBUG_OUTPUT函数的典型用法代码示例。如果您正苦于以下问题:C++ DEBUG_OUTPUT函数的具体用法?C++ DEBUG_OUTPUT怎么用?C++ DEBUG_OUTPUT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DEBUG_OUTPUT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DEBUG_OUTPUT
void LocalPC::makeMaster()
{
bool online = false;
DEBUG_OUTPUT("[LocalPC]try make MASTER\n");
DEBUG_OUTPUT("[LocalPC]I'm %s\n", LOCAL_MASTER==getState()?"MASTER":"SLAVE");
enter();
online = floatIPOnline();
leave();
if(online)
{
DEBUG_OUTPUT("[LocalPC]ip(%s) online\n", mFloatIP);
return;
}
bool master = !isSlave();
if(master)
{
makeSlave();
return;
}
enter();
DEBUG_OUTPUT("[LocalPC]add ip(%s) to ethernet(%s) ... \n", mFloatIP, mEthernet);
Ipconfig ipconfig;
ipconfig.addIP(mEthernet, mFloatIP, mFloatNetmask, mFloatGateway);
online = floatIPOnline();
leave();
if(online)
{
DEBUG_OUTPUT("[LocalPC]add ip ok\n");
setState(LOCAL_MASTER);
}
}
示例2: DEBUG_ENTER
MyMoneyMoney ReportAccount::deepCurrencyPrice(const QDate& date, bool exactDate) const
{
DEBUG_ENTER(Q_FUNC_INFO);
MyMoneyMoney result(1, 1);
MyMoneyFile* file = MyMoneyFile::instance();
MyMoneySecurity undersecurity = file->security(currencyId());
if (! undersecurity.isCurrency()) {
const MyMoneyPrice &price = file->price(undersecurity.id(), undersecurity.tradingCurrency(), date, exactDate);
if (price.isValid()) {
result = price.rate(undersecurity.tradingCurrency());
DEBUG_OUTPUT(QString("Converting under %1 to deep %2, price on %3 is %4")
.arg(undersecurity.name())
.arg(file->security(undersecurity.tradingCurrency()).name())
.arg(date.toString())
.arg(result.toDouble()));
} else {
DEBUG_OUTPUT(QString("No price to convert under %1 to deep %2 on %3")
.arg(undersecurity.name())
.arg(file->security(undersecurity.tradingCurrency()).name())
.arg(date.toString()));
result = MyMoneyMoney();
}
}
return result;
}
示例3: nrf24l01p_transmit
uint8_t nrf24l01p_transmit( uint8_t *data, uint8_t len ){
uint8_t status;
uint8_t ret;
/* Check fifo full */
status = nrf24l01p_singleReadReg( FIFO_STATUS );
if( fifo_tx_full( status ) ){
DEBUG_OUTPUT( "transmit error: fifo full\n" );
return 0;
}
nrf24l01p_doCommand( W_TX_PAYLOAD, data, 0, len );
if( nrf24l01p_conf.config & (1<<MASK_TX_DS) ){ // Interrupt disabled
while( 1 ){
status = nrf24l01p_singleReadReg( STATUS );
if( status & (1<<TX_DS) ){
ret = 1;
break;
}
else if( status & (1<<MAX_RT) ){
DEBUG_OUTPUT( "transmit error: timeout\r\n" );
ret = 0;
break;
}
}
}
//nrf24l01p_singleWriteReg( STATUS, 0xff );
return ret;
}
示例4: BlockFile
/// Constructs a SimpleBlockFile based on sample data and writes
/// it to disk.
///
/// @param baseFileName The filename to use, but without an extension.
/// This constructor will add the appropriate
/// extension (.au in this case).
/// @param sampleData The sample data to be written to this block.
/// @param sampleLen The number of samples to be written to this block.
/// @param format The format of the given samples.
/// @param allowDeferredWrite Allow deferred write-caching
SimpleBlockFile::SimpleBlockFile(wxFileName baseFileName,
samplePtr sampleData, sampleCount sampleLen,
sampleFormat format,
bool allowDeferredWrite /* = false */):
BlockFile(wxFileName(baseFileName.GetFullPath() + wxT(".au")), sampleLen)
{
mCache.active = false;
DEBUG_OUTPUT("SimpleBlockFile created based on sample data");
bool useCache = GetCache();
if (!(allowDeferredWrite && useCache))
WriteSimpleBlockFile(sampleData, sampleLen, format, NULL);
if (useCache) {
DEBUG_OUTPUT("Caching block file data");
mCache.active = true;
mCache.needWrite = true;
mCache.format = format;
mCache.sampleData = new char[sampleLen * SAMPLE_SIZE(format)];
memcpy(mCache.sampleData,
sampleData, sampleLen * SAMPLE_SIZE(format));
void* summaryData = BlockFile::CalcSummary(sampleData, sampleLen,
format);
mCache.summaryData = new char[mSummaryInfo.totalSummaryBytes];
memcpy(mCache.summaryData, summaryData,
(size_t)mSummaryInfo.totalSummaryBytes);
}
}
示例5: pthread_mutex_lock
static void *thread_task_entry(void *arg)
{
// attention! here no lock
easy_tp_man *manager = ((thread_task_arg *)(arg))->man;
thread_info *ti = ((thread_task_arg *)(arg))->ti;
int id = ((thread_task_arg *)(arg))->id;
//
for (;;)
{
task_node *task;
int ret = 0;
struct timespec ts;
pthread_mutex_lock(ti->active_mutex);
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += THREAD_TIMED_OUT;
while (ti->task == NULL && ret == 0)
ret = pthread_cond_timedwait(ti->active_cond, ti->active_mutex, &ts);
task = ti->task;
ti->task = NULL;
if (ret == ETIMEDOUT && ti->task == NULL)
{
DEBUG_OUTPUT("thread %d time out\n", id);
ti->timedout = 1;
}
pthread_mutex_unlock(ti->active_mutex);
if (!task)
{
DEBUG_OUTPUT("thread %d happend a NULL task\n", id);
break;
}
if (task->func != exit_task_entry)
{
// ASSERT(ti->task);
task->desc->ret = task->func(task->desc->arg);
if (task->desc->fire_task_over)
task->desc->fire_task_over(task->desc);
free(task);
// become idle
pthread_mutex_lock(manager->idle_threads.mutex);
manager->idle_threads.idxs[manager->idle_threads.size++] = id;
pthread_mutex_unlock(manager->idle_threads.mutex);
pthread_cond_signal(manager->idle_threads.cond);
}
else
{
free(task);
break;
}
}
exit_task_entry(&id);
free(arg);
return 0;
}
示例6: gps_satellite_telemetry
void gps_satellite_telemetry() {
DEBUG_OUTPUT("Time: %02d:%02d:%02d\r\n", NMEA::getHour(), NMEA::getMinute(), NMEA::getSecond());
DEBUG_OUTPUT("Satellites: %d\r\n", NMEA::getSatellites());
DEBUG_OUTPUT("Latitude: %0.5f\r\n", NMEA::getLatitude());
DEBUG_OUTPUT("Longitude: %0.5f\r\n", NMEA::getLongitude());
DEBUG_OUTPUT("Altitude: %0.2fm\r\n", NMEA::getAltitude());
DEBUG_OUTPUT("Speed: %0.2fkm/h\r\n", NMEA::getSpeed());
DEBUG_OUTPUT("GPS Bearing (Track made good): %0.2f degrees\r\n", NMEA::getBearing());
DEBUG_OUTPUT("Compass Bearing: %03.0f\r\n", bearing);
DEBUG_OUTPUT("Heading Delta to Waypoint: %03.0f\r\n", heading_delta(180.0, bearing));
DEBUG_OUTPUT("Distance to Next Nav %06.2fm\r\n",
distance_to_current_nav(degToRad((double)NMEA::getLatitude()), degToRad((double)NMEA::getLongitude()))
);
#ifdef SEND_TELEMETRY
shedBoat_Telemetry telemetryMessage = shedBoat_Telemetry_init_zero;
if(autopilotEngaged) {
telemetryMessage.status = shedBoat_Telemetry_Status_UNDERWAY_AUTOPILOT;
}
else {
telemetryMessage.status = shedBoat_Telemetry_Status_UNDERWAY_MANUAL;
}
telemetryMessage.has_location = true;
telemetryMessage.location.has_latitude = true;
telemetryMessage.location.latitude = NMEA::getLatitude();
telemetryMessage.location.has_longitude = true;
telemetryMessage.location.longitude = NMEA::getLongitude();
telemetryMessage.location.has_number_of_satellites_visible = true;
telemetryMessage.location.number_of_satellites_visible = NMEA::getSatellites();
telemetryMessage.location.has_true_heading = true;
telemetryMessage.location.true_heading = heading * 1000;
telemetryMessage.location.has_true_bearing = true;
telemetryMessage.location.true_bearing = bearing * 1000;
telemetryMessage.location.has_speed_over_ground = true;
telemetryMessage.location.speed_over_ground = NMEA::getSpeed() * 1000;
telemetryMessage.location.has_utc_seconds = true;
telemetryMessage.location.utc_seconds = NMEA::getSecond();
telemetryMessage.location.fix_quality = (_shedBoat_Location_Quality)NMEA::getFixQuality();
telemetryMessage.location.has_distance_to_waypoint = true;
telemetryMessage.location.distance_to_waypoint = (int32_t)distance_to_current_nav(degToRad((double)NMEA::getLatitude()), degToRad((double)NMEA::getLongitude()));
telemetryMessage.location.has_waypoint_number = true;
telemetryMessage.location.waypoint_number = get_nav_num();
uint8_t buffer[100];
pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
bool success = pb_encode(&stream, shedBoat_Telemetry_fields, &telemetryMessage);
if(success) {
send_xbee_packet(buffer, stream.bytes_written);
} else {
error("Failed to encode Proto Buffer");
}
#endif
}
示例7: Java_xxl_core_io_raw_NativeRawAccess_read
JNIEXPORT void JNICALL
Java_xxl_core_io_raw_NativeRawAccess_read (JNIEnv *env, jobject obj, jbyteArray jblock, jlong sector) {
FILE *jfilep = (FILE*) getfilep(env, obj); // Get the device int
jlong fpos; // The position to read on the device
jint sectorSize = getsectorSize(env, obj);
jlong len = (*env)->GetArrayLength(env, jblock);
jbyte *block = (*env)->GetByteArrayElements(env, jblock, 0);
#ifdef SEQ_OPT
jlong lastSector = getlastSector(env, obj);
#endif
DEBUG_OUTPUT("read: sector==%d", (long) sector);
if (jfilep==0) {
reportError(env,obj,"file not open");
return;
}
// Is it exactly one block
if (len!=sectorSize) {
reportError(env,obj,"byte array does not have sector size");
return;
}
#ifdef SEQ_OPT
if (sector != lastSector+1) {
// non sequential access!
#endif
fpos = (jlong) sector * sectorSize;
if (fseek(jfilep,fpos,SEEK_SET)==-1) {
reportError(env,obj,"filepointer could not be set");
return;
}
#ifdef SEQ_OPT
}
#endif
DEBUG_OUTPUT("read the block",0);
// Read the block
if (fread(block, 1, sectorSize, jfilep)!=sectorSize) {
reportError(env,obj,"read failed");
return;
}
// Convert the c block array to a java byte array
(*env)->SetByteArrayRegion(env, jblock, 0, sectorSize, block);
#ifdef SEQ_OPT
setlastSector(env, obj, sector);
#endif
(*env)->ReleaseByteArrayElements(env, jblock, block, 0);
}
示例8: enter
void LocalPC::makeSlave()
{
bool found = false;
enter();
DEBUG_OUTPUT("[LocalPC]delete ip(%s) from ethernet(%s) ... \n", mFloatIP, mEthernet);
Ipconfig ipconfig;
ipconfig.delIP(mEthernet, mFloatIP);
found = (!ipconfig.hasIP(mFloatIP));
leave();
if(found)
{
DEBUG_OUTPUT("[LocalPC]delete ip ok\n");
setState(LOCAL_SLAVE);
}
}
示例9: HubDriverDeviceReset
//*****************************************************************************
//
// Start the process of enumerating a new device by issuing a reset to the
// appropriate downstream port.
//
//*****************************************************************************
static void
HubDriverDeviceReset(uint8_t ui8Port)
{
DEBUG_OUTPUT("Starting enumeration for port %d\n", ui8Port);
//
// Record the fact that we are in the process of enumerating a device.
//
g_sRootHub.bEnumerationBusy = true;
//
// Save the port that is being enumerated.
//
g_sRootHub.ui8EnumIdx = ui8Port;
//
// Mark the port as being reset.
//
g_sRootHub.psPorts[ui8Port].iState = ePortResetActive;
//
// Initiate a reset on the relevant port to start the enumeration process.
//
HubSetPortFeature(&g_sRootHub, ui8Port, HUB_FEATURE_PORT_RESET);
}
示例10: MyMoneyAccount
ReportAccount::ReportAccount(const QString& accountid):
MyMoneyAccount(MyMoneyFile::instance()->account(accountid))
{
DEBUG_ENTER(Q_FUNC_INFO);
DEBUG_OUTPUT(QString("Account %1").arg(accountid));
calculateAccountHierarchy();
}
示例11: send_debug_telemetry
void send_debug_telemetry()
{
#ifdef SEND_TELEMETRY
shedBoat_Telemetry telemetryMessage = shedBoat_Telemetry_init_zero;
telemetryMessage.status = shedBoat_Telemetry_Status_STATIONARY;
telemetryMessage.has_debug = true;
telemetryMessage.debug.has_bearing_compensation = true;
telemetryMessage.debug.bearing_compensation = bearingCompensation * 1000;
telemetryMessage.debug.has_speed_over_ground_compensation = true;
telemetryMessage.debug.speed_over_ground_compensation = speedOverGroundCompensation * 1000;
telemetryMessage.debug.has_motor_1_throttle_compensation = true;
telemetryMessage.debug.motor_1_throttle_compensation = leftThrottle * 1000;
telemetryMessage.debug.has_motor_2_throttle_compensation = true;
telemetryMessage.debug.motor_2_throttle_compensation = rightThrottle * 1000;
uint8_t buffer[100];
pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
bool success = pb_encode(&stream, shedBoat_Telemetry_fields, &telemetryMessage);
if(success) {
send_xbee_packet(buffer, stream.bytes_written);
} else {
error("Failed to encode Proto Buffer");
DEBUG_OUTPUT("Failed to encode Proto Buffer /r/n");
}
#endif
}
示例12: printString
void printString(const String* inStr)
{
if(inStr->length == 0)
return;
DEBUG_OUTPUT(("%.*s", inStr->length, inStr->str));
}
示例13: HubGetPortStatus
//*****************************************************************************
//
// This function is used to retrieve the current status of a port on the
// hub.
//
// \param psHubInstance is the hub device instance.
// \param ui8Port is the port number for this request.
// \param pui16PortStatus is a pointer to the memory to store the current
// status of the port.
// \param pui16PortChange is a pointer to the memory to store the current
// change status of the ports.
//
// This function is used to retrieve the current overall status and change
// status for the port given in the \e ui8Port parameter. The \e ui8Port value
// indicates which port number to send this request to and can range from 0 to
// the number of valid ports on the given hub. A \e ui8Port value of 0 is an
// access to the hub itself and not one of the hub ports.
//
// \return None.
//
//*****************************************************************************
static bool
HubGetPortStatus(tHubInstance *psHubInstance, uint8_t ui8Port,
uint16_t *pui16PortStatus, uint16_t *pui16PortChange)
{
uint32_t ui32Data, ui32Read;
tUSBRequest sSetupPacket;
tUSBHostDevice *psDevice;
//
// Retrieve the device pointer.
//
psDevice = psHubInstance->psDevice;
//
// This is a standard OUT request.
//
sSetupPacket.bmRequestType = USB_RTYPE_DIR_IN | USB_RTYPE_CLASS |
USB_RTYPE_OTHER;
//
// Set the fields to get the hub status.
//
sSetupPacket.bRequest = USBREQ_GET_STATUS;
sSetupPacket.wValue = 0;
sSetupPacket.wIndex = (uint16_t)ui8Port;
sSetupPacket.wLength = 4;
//
// Send the request.
//
ui32Read = USBHCDControlTransfer(0, &sSetupPacket, psDevice,
(uint8_t *)&ui32Data, 4,
psDevice->sDeviceDescriptor.bMaxPacketSize0);
//
// Check that we received the correct number of bytes.
//
if(ui32Read != 4)
{
return(false);
}
else
{
//
// We got 4 bytes from the device. Now translate these into the 2
// 16-bit values we pass back to the caller.
//
*pui16PortStatus = (uint16_t)(ui32Data & 0xFFFF);
*pui16PortChange = (uint16_t)(ui32Data >> 16);
DEBUG_OUTPUT("Port %d, status 0x%04x, change 0x%04x\n", ui8Port,
*pui16PortStatus, *pui16PortChange);
}
//
// All is well.
//
return(true);
}
示例14: USBHHubClose
//*****************************************************************************
//
//! This function is used to release a hub device instance.
//!
//! \param psHubInstance is the hub device instance that is to be released.
//!
//! This function is called when an instance of the hub device must be
//! released. This function is typically made in preparation for shutdown or a
//! switch to function as a USB device when in OTG mode. Following this call,
//! the hub device is no longer available, but it can be opened again using a
//! call to USBHHubOpen(). After calling USBHHubClose(), the host hub driver
//! no longer provides any callbacks or accepts calls to other hub driver APIs.
//!
//! \return None.
//
//*****************************************************************************
void
USBHHubClose(tHubInstance *psHubInstance)
{
//
// Forget the instance pointer and callback.
//
psHubInstance->psDevice = 0;
psHubInstance->pfnCallback = 0;
DEBUG_OUTPUT("USBHHubClose completed.\n");
}
示例15: DEBUG_OUTPUT
/// Read the summary section of the disk file.
///
/// @param *data The buffer to write the data to. It must be at least
/// mSummaryinfo.totalSummaryBytes long.
bool SimpleBlockFile::ReadSummary(void *data)
{
if (mCache.active)
{
DEBUG_OUTPUT("ReadSummary: Summary is already in cache");
memcpy(data, mCache.summaryData, (size_t)mSummaryInfo.totalSummaryBytes);
return true;
} else
{
DEBUG_OUTPUT("ReadSummary: Reading summary from disk");
wxFFile file(mFileName.GetFullPath(), wxT("rb"));
wxLogNull *silence=0;
if(mSilentLog)silence= new wxLogNull();
if(!file.IsOpened() ){
memset(data,0,(size_t)mSummaryInfo.totalSummaryBytes);
if(silence) delete silence;
mSilentLog=TRUE;
return true;
}
if(silence) delete silence;
mSilentLog=FALSE;
// The offset is just past the au header
if( !file.Seek(sizeof(auHeader)) )
return false;
int read = (int)file.Read(data, (size_t)mSummaryInfo.totalSummaryBytes);
FixSummary(data);
return (read == mSummaryInfo.totalSummaryBytes);
}
}