本文整理汇总了C++中debugError函数的典型用法代码示例。如果您正苦于以下问题:C++ debugError函数的具体用法?C++ debugError怎么用?C++ debugError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debugError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool
VolumeControlLowRes::setValue(int v)
{
uint32_t reg;
uint32_t old_reg;
if (v>0xFF) v=0xFF;
else if (v<0) v=0;
if ( !m_Parent.getSpecificValue(m_cmd_id, ®) ) {
debugError( "getSpecificValue failed\n" );
return 0;
}
old_reg=reg;
reg &= ~(0xFF<<m_bit_shift);
reg |= (v<<m_bit_shift);
debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for id %d to %d, shift %d (reg: 0x%08X => 0x%08X)\n",
m_cmd_id, v, m_bit_shift, old_reg, reg);
if ( !m_Parent.setSpecificValue(m_cmd_id, reg) ) {
debugError( "setSpecificValue failed\n" );
return false;
} else return true;
}
示例2: debugError
bool
EfcCmd::deserialize( Util::Cmd::IISDeserialize& de )
{
bool result=true;
result &= de.read(&m_length);
m_length=CondSwapFromBus32(m_length);
// read the EFC header
quadlet_t *header_as_quadlets=(quadlet_t *)&m_header;
for (unsigned int i=0; i<sizeof(m_header)/4; i++) {
result &= de.read((header_as_quadlets+i));
*(header_as_quadlets+i)=CondSwapFromBus32(*(header_as_quadlets+i));
}
// check the EFC version
if(m_header.version > 1) {
debugError("Unsupported EFC version: %d\n", m_header.version);
return false;
}
// check whether the category and command of the response are valid
if (m_header.category != m_category_id) {
debugError("Invalid category response: %d != %d\n", m_header.category, m_category_id);
return false;
}
if (m_header.command != m_command_id) {
debugError("Invalid command response: %d != %d\n", m_header.command, m_command_id);
return false;
}
return result;
}
示例3: extPlugInfoCmd
uint8_t
Device::getConfigurationIdNumberOfChannel( PlugAddress::EPlugDirection ePlugDirection )
{
ExtendedPlugInfoCmd extPlugInfoCmd( get1394Service() );
UnitPlugAddress unitPlugAddress( UnitPlugAddress::ePT_PCR,
0 );
extPlugInfoCmd.setPlugAddress( PlugAddress( ePlugDirection,
PlugAddress::ePAM_Unit,
unitPlugAddress ) );
extPlugInfoCmd.setNodeId( getNodeId() );
extPlugInfoCmd.setCommandType( AVCCommand::eCT_Status );
extPlugInfoCmd.setVerbose( getDebugLevel() );
ExtendedPlugInfoInfoType extendedPlugInfoInfoType(
ExtendedPlugInfoInfoType::eIT_NoOfChannels );
extendedPlugInfoInfoType.initialize();
extPlugInfoCmd.setInfoType( extendedPlugInfoInfoType );
if ( !extPlugInfoCmd.fire() ) {
debugError( "Number of channels command failed\n" );
return 0;
}
ExtendedPlugInfoInfoType* infoType = extPlugInfoCmd.getInfoType();
if ( infoType
&& infoType->m_plugNrOfChns )
{
debugOutput(DEBUG_LEVEL_VERBOSE, "Number of channels 0x%02x\n",
infoType->m_plugNrOfChns->m_nrOfChannels );
return infoType->m_plugNrOfChns->m_nrOfChannels;
}
debugError( "Could not retrieve number of channels\n" );
return 0;
}
示例4: debugOutput
bool
Device::destroyMixer() {
bool ret = true;
debugOutput(DEBUG_LEVEL_VERBOSE, "destroy mixer...\n");
if (m_MixerContainer == NULL) {
debugOutput(DEBUG_LEVEL_VERBOSE, "no mixer to destroy...\n");
} else
if (!deleteElement(m_MixerContainer)) {
debugError("Mixer present but not registered to the avdevice\n");
ret = false;
} else {
// remove and delete (as in free) child control elements
m_MixerContainer->clearElements(true);
delete m_MixerContainer;
m_MixerContainer = NULL;
}
// remove control container
if (m_ControlContainer == NULL) {
debugOutput(DEBUG_LEVEL_VERBOSE, "no controls to destroy...\n");
} else
if (!deleteElement(m_ControlContainer)) {
debugError("Controls present but not registered to the avdevice\n");
ret = false;
} else {
// remove and delete (as in free) child control elements
m_ControlContainer->clearElements(true);
delete m_ControlContainer;
m_ControlContainer = NULL;
}
return false;
}
示例5: extStreamFormatCmd
uint8_t
Device::getConfigurationIdSampleRate()
{
ExtendedStreamFormatCmd extStreamFormatCmd( get1394Service() );
UnitPlugAddress unitPlugAddress( UnitPlugAddress::ePT_PCR, 0 );
extStreamFormatCmd.setPlugAddress( PlugAddress( PlugAddress::ePD_Input,
PlugAddress::ePAM_Unit,
unitPlugAddress ) );
extStreamFormatCmd.setNodeId( getNodeId() );
extStreamFormatCmd.setCommandType( AVCCommand::eCT_Status );
extStreamFormatCmd.setVerbose( getDebugLevel() );
if ( !extStreamFormatCmd.fire() ) {
debugError( "Stream format command failed\n" );
return 0;
}
FormatInformation* formatInfo =
extStreamFormatCmd.getFormatInformation();
FormatInformationStreamsCompound* compoundStream
= dynamic_cast< FormatInformationStreamsCompound* > (
formatInfo->m_streams );
if ( compoundStream ) {
debugOutput(DEBUG_LEVEL_VERBOSE, "Sample rate 0x%02x\n",
compoundStream->m_samplingFrequency );
return compoundStream->m_samplingFrequency;
}
debugError( "Could not retrieve sample rate\n" );
return 0;
}
示例6: createPidFile
// ----------------------------------------------------
// Creates the pid file for a given instance directory.
// and a given pid.
// If the file could be created returns TRUE and FALSE
// otherwise.
// ----------------------------------------------------
BOOL createPidFile(const char* instanceDir, int pid)
{
BOOL returnValue = FALSE;
char pidFile[PATH_SIZE];
FILE *f;
debug("createPidFile(instanceDir='%s',pid=%d)", instanceDir, pid);
if (getPidFile(instanceDir, pidFile, PATH_SIZE))
{
if ((f = fopen(pidFile, "w")) != NULL)
{
fprintf(f, "%d", pid);
fclose (f);
returnValue = TRUE;
debug("Successfully put pid=%d in the pid file '%s'.", pid, pidFile);
}
else
{
debugError("Couldn't create the pid file '%s' because the file could not be opened.", pidFile);
returnValue = FALSE;
}
}
else
{
debugError("Couldn't create the pid file because the pid file name could not be constructed.");
returnValue = FALSE;
}
return returnValue;
} // createPidFile
示例7: debugError
bool
BinaryControl::setValue(int v)
{
uint32_t reg;
uint32_t old_reg;
if ( !m_Parent.getSpecificValue(m_cmd_id, ®) ) {
debugError( "getSpecificValue failed\n" );
return 0;
}
old_reg=reg;
if (v) {
reg |= (1<<m_cmd_bit);
} else {
reg &= ~(1<<m_cmd_bit);
}
debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for id %d to %d (reg: 0x%08X => 0x%08X)\n",
m_cmd_id, v, old_reg, reg);
if ( !m_Parent.setSpecificValue(m_cmd_id, reg) ) {
debugError( "setSpecificValue failed\n" );
return false;
} else return true;
}
示例8: OAEP_decode
/**
* PKCS #1 OAEP decoding
*/
static int OAEP_decode(unsigned char *message,
unsigned int encoded_bytes, const unsigned char *encoded,
unsigned int label_bytes, const unsigned char *label) {
unsigned int i, message_bytes;
unsigned char DB[RSA_MOD_BYTES - RSA_SHA_BYTES - 1 /* Add MGF1 buffer space */ + 4];
unsigned char seed[RSA_SHA_BYTES /* Add MGF1 buffer space */ + 4];
debugValue("OAEP decode: encoded message", encoded, encoded_bytes);
// First byte of encoded message must be 0x00
if(encoded[0] != 0x00) {
debugError("First byte of OAEP encoded message is not 0x00");
return RSA_ERROR_OAEP_DECODE;
}
// Extract maskedDB and maskedSeed
debugValue("OAEP decode: maskedSeed", encoded + 1, RSA_SHA_BYTES);
Copy(RSA_SHA_BYTES, DB, encoded + 1 + RSA_SHA_BYTES);
debugValue("OAEP decode: maskedDB", encoded + 1 + RSA_SHA_BYTES, RSA_MOD_BYTES - RSA_SHA_BYTES - 1);
// Finding seed and DB
MGF1(RSA_MOD_BYTES - RSA_SHA_BYTES - 1, DB, RSA_SHA_BYTES, seed);
debugValue("OAEP decode: seedMask", seed, RSA_SHA_BYTES);
XorAssign(RSA_SHA_BYTES, seed, encoded + 1);
debugValue("OAEP decode: seed", seed, RSA_SHA_BYTES);
MGF1(RSA_SHA_BYTES, seed, RSA_MOD_BYTES - RSA_SHA_BYTES - 1, DB);
debugValue("OAEP decode: dbMask", DB, RSA_MOD_BYTES - RSA_SHA_BYTES - 1);
XorAssign(RSA_MOD_BYTES - RSA_SHA_BYTES - 1, DB, encoded + 1 + RSA_SHA_BYTES);
debugValue("OAEP decode: DB", DB, RSA_MOD_BYTES - RSA_SHA_BYTES - 1);
// Compute the hash of l
debugValue("OAEP decode: label", label, label_bytes);
SHA(RSA_SHA_BYTES, seed, label_bytes, label);
debugValue("OAEP decode: hash of label", seed, RSA_SHA_BYTES);
// Check whether the first RSA_SHA_BYTES bytes of DB equal to lHash
if (NotEqual(RSA_SHA_BYTES, seed, DB)) {
debugError("First RSA_SHA_BYTES of DB do not match with hash of label");
return RSA_ERROR_OAEP_DECODE;
}
// Try to locate the message in DB
i = RSA_SHA_BYTES;
while ((DB[i] == 0x00) && (DB[i] != 0x01) && (i < (RSA_MOD_BYTES - RSA_SHA_BYTES - 1 - 1))) i++;
if ((i == (RSA_MOD_BYTES - RSA_SHA_BYTES - 1 - 1)) || (DB[i] != 0x01)) {
debugError("Failed to locate the message in DB");
return RSA_ERROR_OAEP_DECODE;
}
// Extract the message, starting after 0x01 byte to the end of DB
message_bytes = RSA_MOD_BYTES - RSA_SHA_BYTES - 1 - 1 - (i + 1) + 1;
CopyBytes(message_bytes, message, DB + i + 1);
debugValue("OAEP decode: recovered message", message, message_bytes);
return message_bytes;
}
示例9: launch
// The goal of these methods is:
// Be able to launch batch files with double-click and not having a
// prompt-window associated with it.
// Launch batch files from the prompt that generate a java process that does not
// block the prompt and that keeps running even if the prompt window is closed.
//
// This function expects the following parameter to be passed:
// the directory of the server we want to start and the
// command line that we want to execute (basically the java
// command that we want to display the status panel). The main reasons
// to have the command line passed are:
// 1. Keep the native code as minimal as possible.
// 2. Allow the administrator some flexibility in the way the
// server is started by leaving most of the logic in the command-line.
//
// Returns the pid of the process associated with the command if it could be
// launched and -1 otherwise.
// ----------------------------------------------------
int launch(char* argv[])
{
int returnValue;
char command[COMMAND_SIZE];
if (getCommandLine(argv, command, COMMAND_SIZE))
{
returnValue = spawn(command, TRUE);
if (returnValue <= 0)
{
debugError("Failed to launch the child process '%s'.", command);
}
else
{
debug("Successfully launched the child process '%s'.", command);
}
}
else
{
debugError("Couldn't launch the child process because the full command line could not be constructed.");
returnValue = -1;
}
return returnValue;
} // launch
示例10: start
// ----------------------------------------------------
// Function called when we want to start the server.
// This function expects the following parameter to be passed:
// the directory of the server we want to start and the
// command line (and its argumets) that we want to execute (basically the java
// command that we want to start the server). The main reasons
// to have the command line passed are:
// 1. Keep the native code as minimal as possible.
// 2. Allow the administrator some flexibility in the way the
// server is started by leaving most of the logic in the command-line.
//
// This approach makes things to be closer between what is proposed
// in windows and in UNIX systems.
//
// If the instance could be started the code will write the pid of the process
// of the server in file that can be used for instance to stop the server
// (see stop.c).
//
// Returns the pid of the process of the instance if it could be started and -1
// otherwise.
// ----------------------------------------------------
int start(const char* instanceDir, char* argv[])
{
int returnValue;
int childPid;
char command[COMMAND_SIZE];
if (getCommandLine(argv, command, COMMAND_SIZE))
{
childPid = spawn(command, TRUE);
if (childPid > 0)
{
createPidFile(instanceDir, childPid);
returnValue = childPid;
}
else
{
debugError("Couldn't start the child process because the spawn failed.");
returnValue = -1;
}
}
else
{
debugError("Couldn't start the child process because the full command line could not be constructed.");
returnValue = -1;
}
return returnValue;
} // start
示例11: sizeof
bool SaffirePro24::discover() {
if (Dice::Device::discover()) {
fb_quadlet_t* version = (fb_quadlet_t *)calloc(2, sizeof(fb_quadlet_t));
getEAP()->readRegBlock(Dice::EAP::eRT_Application, SAFFIRE_PRO24_REGISTER_APP_VERSION, version, 1*sizeof(fb_quadlet_t));
// On August 2013, Focusrite released a new firmware.
// Version numbering 2.0 (0x00020000) seems common to all Saffire
// Dice EAP devices.
// Note: 0x00010004 and 0x00010008 stands for a firmware version
// not for a device identity. 0x00010004 is a pro24, 0x00010008
// is the pro24dsp.
if (version[0] != 0x00010004 && version[0] != 0x00010008 && version[0] != 0x00020000) {
debugError("This is a Focusrite Saffire Pro24 but not the right firmware. Better stop here before something goes wrong.\n");
debugError("This device has firmware 0x%x while we only know about versions 0x%x, 0x%x and 0x%x.\n", version[0], 0x10004, 0x10008, 0x00020000);
return false;
}
// FIXME: What is the purpose of the following commented lines at this point ?
//getEAP()->readRegBlock(Dice::EAP::eRT_Command, 0x00, tmp, 2*sizeof(fb_quadlet_t)); // DEBUG
//hexDumpQuadlets(tmp, 2); // DEBUG
FocusriteEAP* eap = dynamic_cast<FocusriteEAP*>(getEAP());
SaffirePro24EAP::MonitorSection* monitor = new SaffirePro24EAP::MonitorSection(eap, "Monitoring");
getEAP()->addElement(monitor);
return true;
}
return false;
}
示例12: debugError
// this has to wait until the ISO channel numbers are written
bool
SlaveDevice::startStreamByIndex(int i) {
if (i<(int)m_receiveProcessors.size()) {
int n=i;
Streaming::StreamProcessor *p=m_receiveProcessors.at(n);
// the other side sends on this channel
nodeaddr_t iso_channel_offset = BOUNCE_REGISTER_RX_ISOCHANNEL;
iso_channel_offset += ((unsigned)n)*4;
if (!waitForRegisterNotEqualTo(iso_channel_offset, 0xFFFFFFFFLU)) {
debugError("Timeout waiting for stream %d to get an ISO channel\n",i);
return false;
}
fb_quadlet_t result;
// this will read from our own registers
if (!readReg(iso_channel_offset, &result)) {
debugError("Could not read ISO channel register for stream %d\n",i);
return false;
}
// set ISO channel
p->setChannel(result);
return true;
} else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) {
int n=i-m_receiveProcessors.size();
Streaming::StreamProcessor *p = m_transmitProcessors.at(n);
// the other side sends on this channel
nodeaddr_t iso_channel_offset = BOUNCE_REGISTER_TX_ISOCHANNEL;
iso_channel_offset += ((unsigned)n)*4;
if (!waitForRegisterNotEqualTo(iso_channel_offset, 0xFFFFFFFF)) {
debugError("Timeout waiting for stream %d to get an ISO channel\n",i);
return false;
}
fb_quadlet_t result;
// this will read from our own registers
if (!readReg(iso_channel_offset, &result)) {
debugError("Could not read ISO channel register for stream %d\n",i);
return false;
}
// set ISO channel
p->setChannel(result);
return true;
}
debugError("SP index %d out of range!\n",i);
return false;
}
示例13: debugOutput
void
PosixMutex::Lock()
{
int err;
debugOutput(DEBUG_LEVEL_ULTRA_VERBOSE, "(%s, %p) lock\n", m_id.c_str(), this);
#if DEBUG_LOCK_COLLISION_TRACING
if(TryLock()) {
// locking succeeded
m_locked_by = debugBacktraceGet( DEBUG_LOCK_COLLISION_TRACING_INDEX );
char name[ DEBUG_LOCK_COLLISION_TRACING_NAME_MAXLEN ];
name[0] = 0;
debugGetFunctionNameFromAddr(m_locked_by, name, DEBUG_LOCK_COLLISION_TRACING_NAME_MAXLEN);
debugOutput(DEBUG_LEVEL_ULTRA_VERBOSE,
"(%s, %p) %s obtained lock\n",
m_id.c_str(), this, name);
return;
} else {
void *lock_try_by = debugBacktraceGet( DEBUG_LOCK_COLLISION_TRACING_INDEX );
char name1[ DEBUG_LOCK_COLLISION_TRACING_NAME_MAXLEN ];
name1[0] = 0;
debugGetFunctionNameFromAddr(lock_try_by, name1, DEBUG_LOCK_COLLISION_TRACING_NAME_MAXLEN);
char name2[ DEBUG_LOCK_COLLISION_TRACING_NAME_MAXLEN ];
name2[0] = 0;
debugGetFunctionNameFromAddr(m_locked_by, name2, DEBUG_LOCK_COLLISION_TRACING_NAME_MAXLEN);
debugWarning("(%s, %p) lock collision: %s wants lock, %s has lock\n",
m_id.c_str(), this, name1, name2);
if((err = pthread_mutex_lock(&m_mutex))) {
if (err == EDEADLK) {
debugError("(%s, %p) Resource deadlock detected\n", m_id.c_str(), this);
debugPrintBacktrace(10);
} else {
debugError("(%s, %p) Error locking the mutex: %d\n", m_id.c_str(), this, err);
}
} else {
debugWarning("(%s, %p) lock collision: %s got lock (from %s?)\n",
m_id.c_str(), this, name1, name2);
}
}
#else
#ifdef DEBUG
if((err = pthread_mutex_lock(&m_mutex))) {
if (err == EDEADLK) {
debugError("(%s, %p) Resource deadlock detected\n", m_id.c_str(), this);
debugPrintBacktrace(10);
} else {
debugError("(%s, %p) Error locking the mutex: %d\n", m_id.c_str(), this, err);
}
}
#else
pthread_mutex_lock(&m_mutex);
#endif
#endif
}
示例14: main
// ----------------------------------------------------
// main function called by the executable. This code is
// called by the start-ds.bat, stop-ds.bat and statuspanel.bat batch files.
//
// The code assumes that the first passed argument is the subcommand to be
// executed and for start and stop the second argument the directory of the
// server.
// The rest of the arguments are the arguments specific to each subcommand (see
// the comments for the functions start, stop and launch).
// ----------------------------------------------------
int main(int argc, char* argv[])
{
int returnCode;
char* subcommand = NULL;
char* instanceDir = NULL;
int i;
debug("main called.");
for (i = 0; i < argc; i++) {
debug(" argv[%d] = '%s'", i, argv[i]);
}
if (argc < 3) {
char * msg =
"Expected command line args of [subcommand], but got %d arguments.\n";
debugError(msg, argc - 1);
fprintf(stderr, msg, argc - 1);
return -1;
}
subcommand = argv[1];
if (strcmp(subcommand, "start") == 0)
{
instanceDir = argv[2];
argv += 3;
returnCode = start(instanceDir, argv);
}
else if (strcmp(subcommand, "stop") == 0)
{
instanceDir = argv[2];
argv += 3;
returnCode = stop(instanceDir);
}
else if (strcmp(subcommand, "launch") == 0)
{
argv += 2;
returnCode = launch(argv);
}
else if (strcmp(subcommand, "run") == 0)
{
argv += 2;
returnCode = run(argv);
}
else
{
char * msg = "Unknown subcommand: [%s]\n";
debugError(msg, subcommand);
fprintf(stderr, msg, subcommand);
returnCode = -1;
}
debug("main finished. Returning %d", returnCode);
return returnCode;
}
示例15: IOMasterPort
int AoEProperties::configure_matching(void)
{
// debugVerbose("AoEProperties::configure_matching\n");
// Obtain ports for notifications (this will be used for all service matching notifications)
kern_return_t kresult;
mach_port_t MasterPort;
kresult = IOMasterPort(MACH_PORT_NULL, &MasterPort);
if ( kresult )
{
debugError("Could not get masterport. Error=%d\n", kresult);
return false;
}
ms_NotificationPort = IONotificationPortCreate(MasterPort);
ms_IOKitNotificationRunLoopSource = IONotificationPortGetRunLoopSource(ms_NotificationPort);
CFRunLoopAddSource(CFRunLoopGetCurrent(), ms_IOKitNotificationRunLoopSource, kCFRunLoopDefaultMode);
// SetUp Notification for matching to our device
CFMutableDictionaryRef MatchingDict = IOServiceMatching(AOE_KEXT_NAME_Q);
IOServiceAddMatchingNotification(ms_NotificationPort,
kIOMatchedNotification,
MatchingDict,
AoEProperties::matched_callback,
this,
&ms_MatchIt);
// Call the callback immediately to check if our iterator already contains our device (ie. the device is already loaded)
matched_callback(this, ms_MatchIt);
return m_fMatched ? 0 : -1;
}