本文整理汇总了C++中DBG_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ DBG_LOG函数的具体用法?C++ DBG_LOG怎么用?C++ DBG_LOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DBG_LOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mac_init
void mac_init(void)
{
#ifdef NODE_TYPE_DETECTOR
lora_init(UART_4, 9600);
#endif
#ifdef NODE_TYPE_GATEWAY
lora_init(UART_1, 9600);
#endif
portBASE_TYPE res = pdTRUE;
res = xTaskCreate(mac_task, //*< task body
"MacTask", //*< task name
200, //*< task heap
NULL, //*< tasK handle param
configMAX_PRIORITIES - 2, //*< task prio
NULL); //*< task pointer
if (res != pdTRUE)
{
DBG_LOG(DBG_LEVEL_ERROR, "mac task init failed\r\n");
}
mac_queue = xQueueCreate(10, sizeof(osel_event_t));
if (mac_queue == NULL)
{
DBG_LOG(DBG_LEVEL_ERROR, "mac_queue init failed\r\n");
}
mac_sent = xSemaphoreCreateBinary();
if (mac_sent == NULL)
{
DBG_LOG(DBG_LEVEL_ERROR, "mac_set init failed\r\n");
}
}
示例2: sizeof
struct append_entries_output_t *get_append_entries_output(struct data_t *append_entries_response) {
struct append_entries_output_t *r = (struct append_entries_output_t *)malloc(
sizeof(struct append_entries_output_t));
if(!r) {
return NULL;
}
if(append_entries_response->length != APPEND_ENTRIES_RES_COUNT) {
free(r);
DBG_LOG(LOG_ERROR, "incorrect number of parameter in RPC response, expected = %d, got = %d",
APPEND_ENTRIES_RES_COUNT, append_entries_response->length);
return NULL;
}
for(int i = 0; i < APPEND_ENTRIES_RES_COUNT; i++) {
if(!append_entries_response->child[i]
|| append_entries_response->child[i]->type != RPC_INT
|| !append_entries_response->child[i]->value) {
free(r);
if(append_entries_response->child[i]) {
DBG_LOG(LOG_ERROR, "incorrect value in param in RPC, expected = %d, got = %d",
RPC_INT, append_entries_response->child[i]->type);
}
return NULL;
}
}
r->term = *(json_int_t *)append_entries_response->child[0]->value;
r->success = *(json_int_t *)append_entries_response->child[1]->value;
return r;
}
示例3: _binpachilti_sink_connect_intern
void _binpachilti_sink_connect_intern(binpac_sink* sink, const hlt_type_info* type, void** pobj, binpac_parser* parser, hlt_bytes* mtype, hlt_exception** excpt, hlt_execution_context* ctx)
{
__parser_state* state = hlt_malloc(sizeof(__parser_state));
state->parser = parser;
GC_CCTOR(state->parser, hlt_BinPACHilti_Parser, ctx);
state->pobj = *pobj;
GC_CCTOR_GENERIC(&state->pobj, type, ctx);
state->data = 0;
state->resume = 0;
state->disconnected = 0;
state->next = sink->head;
sink->head = state;
#ifdef DEBUG
if ( mtype ) {
hlt_string s = hlt_string_decode(mtype, Hilti_Charset_ASCII, excpt, ctx);
char* r1 = hlt_string_to_native(s, excpt, ctx);
char* r2 = hlt_string_to_native(parser->name, excpt, ctx);
DBG_LOG("binpac-sinks", "connected parser %s [%p] to sink %p for MIME type %s", r2, *pobj, sink, r1);
hlt_free(r1);
hlt_free(r2);
}
else {
char* p = hlt_string_to_native(parser->name, excpt, ctx);
DBG_LOG("binpac-sinks", "connected parser %s [%p] to sink %p", p, *pobj, sink);
hlt_free(p);
}
#endif
}
示例4: autolink_mcu_parse_radio_savereq
/*******************************************************************************
Function
*******************************************************************************/
static void autolink_mcu_parse_radio_savereq(uint8* data,uint32 len)
{
sint32 freq = byte_to_int(0,0,data[2],data[3]);
switch(data[0])
{
case MCU_RADIO_DATA1_ALREADY_SAVEFREQ_BAND_FM:
mcu_info_data.radio.save.band = RADIO_BAND_FM;
mcu_info_data.radio.save.freq = (float)freq/100;
DBG_LOG("GET:save freq FM %f\n",mcu_info_data.radio.save.freq);
break;
case MCU_RADIO_DATA1_ALREADY_SAVEFREQ_BAND_AM:
mcu_info_data.radio.save.band = RADIO_BAND_AM;
mcu_info_data.radio.save.freq = freq;
DBG_LOG("GET:save freq AM %d\n",mcu_info_data.radio.save.freq);
break;
default:
ERR_LOG("GET:save freq unkown\n");
return;
}
mcu_info_data.radio.save.freq_position = data[1];
DBG_LOG("GET:save freq radio position %d\n",mcu_info_data.radio.save.freq_position);
autolink_emit_mcu_state(TYPE_RADIO_SAVEFREQ,mcu_info_data);
return;
}
示例5: binpac_dbg_reassembler_buffer
void binpac_dbg_reassembler_buffer(binpac_sink* sink, const char* msg, hlt_exception** excpt, hlt_execution_context* ctx)
{
#ifdef DEBUG
if ( ! sink->first_chunk ) {
DBG_LOG("binpac-sinks", "reassembler/%p: no data buffered", sink);
return;
}
char buffer[128];
int i = 0;
uint64_t initial_seq; // Initial sequence number.
uint64_t cur_rseq; // Sequence of last delivered byte + 1 (i.e., seq of next)
uint64_t last_reassem_rseq; // Sequence of last byte reassembled and delivered + 1.
uint64_t trim_rseq; // Sequence of last byte trimmed so far + 1.
__chunk* first_chunk; // First not yet reassembled chunk. Has ownership.
__chunk* last_chunk; // Last not yet reassembled chunk.
DBG_LOG("binpac-sinks", "reassembler/%p: %s ("
"cur_rseq=%" PRIu64 " "
"last_reassem_rseq=%" PRIu64 " "
"trim_rseq=%" PRIu64 ")",
sink, msg, sink->cur_rseq, sink->last_reassem_rseq, sink->trim_rseq);
for ( __chunk* c = sink->first_chunk; c; c = c->next ) {
snprintf(buffer, sizeof(buffer), "* chunk %d:", i);
binpac_dbg_reassembler(sink, buffer, c->data, c->rseq, (c->rupper - c->rseq), excpt, ctx);
i++;
}
#endif
}
示例6: DBG_LOG
struct data_t *make_request_vote_rpc_response(struct request_vote_output_t *output) {
struct data_t *res = (struct data_t *)malloc(sizeof(struct data_t));
if(!res){
DBG_LOG(LOG_FATAL, "memory allocation failed");
return NULL;
}
res->type = RPC_VECTOR;
res->length = REQUEST_VOTE_RES_COUNT;
res->child = (struct data_t **)malloc(
sizeof(struct data_t *)*REQUEST_VOTE_RES_COUNT);
if(!res->child) {
free(res);
DBG_LOG(LOG_FATAL, "memory allocation failed");
return NULL;
}
res->child[0] = uint64_to_data_t(output->term);
res->child[1] = uint32_to_data_t(output->vote_granted);
for(int i = 0; i < REQUEST_VOTE_RES_COUNT; i++) {
if(!res->child[i]) {
res->length = i;
free_data_t(res);
DBG_LOG(LOG_FATAL, "memory allocation failed");
return NULL;
}
}
return res;
}
示例7: DBG_LOGLN
int16_t Z_OSCMessage::setZ_OSCAddress(const char *_address){
oscAdrSize=(uint16_t)strlen(_address);
if( oscAdrSize > kMaxZ_OSCAdrCharactor ){
DBG_LOGLN("set Z_OSC max Z_OSC Adr err");
flush();
return 1;
}
if(oscAddress!=NULL) free(oscAddress);
oscAddress=(char*)calloc(1,oscAdrSize+1);
strcpy(oscAddress,_address);
oscAdrPacSize=getPackSize(oscAdrSize);
DBG_LOG("set Z_OSC Adr:");
DBG_LOG(oscAddress);
DBG_LOG(" size:");
DBG_LOG(oscAdrSize);
DBG_LOG(" packsize:");
DBG_LOGLN(oscAdrPacSize);
return 0;
}
示例8: pxy_http_epollin
static int pxy_http_epollin(int fd, void * private_data)
{
con_t * con = (con_t *)private_data;
int rlen;
int ret;
rlen = MAX_CB_BUF - con->cb_totlen;
ret = recv(fd, &con->cb_buf[con->cb_totlen], rlen, 0);
if(ret <= 0) {
DBG_LOG(MSG, MOD_PROXYD, "[closing fd:%d]recv returned %d." , fd, ret) ;
close_conn(fd);
return TRUE;
}
con->cb_totlen += ret;
if (CHECK_CON_FLAG(con, CONF_CLIENT_SIDE)) {
glob_pxy_tot_size_from_client += ret;
} else {
glob_pxy_tot_size_from_origin_svr += ret;
}
DBG_LOG(MSG, MOD_PROXYD,
"[fd:%d]recv returned %d., fwding data to peer" ,
fd, ret) ;
forward_data_to_peer(con);
return TRUE;
}
示例9: autolink_mcu_packet_parse
/*******************************************************************************
Function Definition
*******************************************************************************/
static void autolink_mcu_packet_parse(uint8 cmd1,uint8* data, sint8 len)
{
DBG_LOG("NEW MSG\n");
DBG_LOG("CMD1=%X\n",cmd1);
switch(cmd1)
{
case MCU_CMD_SYSTEM:
autolink_mcu_parse_system(data,len);
break;
case MCU_CMD_KEY:
autolink_mcu_parse_key(data,len);
break;
case MCU_CMD_RADIO:
autolink_mcu_parse_radio(data,len);
break;
case MCU_CMD_SETTING:
autolink_mcu_parse_setting(data,len);
break;
case MCU_CMD_MEDIA:
autolink_mcu_parse_media(data,len);
break;
case MCU_CMD_UPDATE:
autolink_mcu_parse_update(data,len);
break;
case MCU_CMD_CAN:
autolink_mcu_parse_can(data,len);
break;
default:
ERR_LOG("UNKOWN MSG\n");
break;
}
return ;
}
示例10: free
struct request_vote_input_t *get_request_vote_input_params(struct data_t *params[], int nparams) {
struct request_vote_input_t *r = (struct request_vote_input_t *)malloc(sizeof(struct request_vote_input_t));
if(!r) {
return NULL;
}
if(nparams != REQUEST_VOTE_PARAM_COUNT) {
free(r);
DBG_LOG(LOG_ERROR, "incorrect number of parameter in RPC, expected = %d, got = %d",
REQUEST_VOTE_PARAM_COUNT, nparams);
return NULL;
}
for(int i = 0; i < REQUEST_VOTE_PARAM_COUNT; i++) {
if(!params[i]
|| params[i]->type != RPC_INT
|| !params[i]->value) {
free(r);
if(params[i]) {
DBG_LOG(LOG_ERROR, "incorrect value in %dth param in RPC, expected = %d, got = %d, value = %x",
(i+1), RPC_INT, params[i]->type, params[i]->value);
}
return NULL;
}
}
r->term = *(json_int_t *)params[0]->value;
r->candidate_id = *(json_int_t *)params[1]->value;
r->last_log_index = *(json_int_t *)params[2]->value;
r->last_log_term = *(json_int_t *)params[3]->value;
return r;
}
示例11: DBG_LOG
UILayoutHandle* UILayoutFactory::Load(const char* url)
{
int url_hash = StringHelper::Hash(url);
// Texture already loaded?
if (m_loaded_layouts.Contains(url_hash))
{
DBG_LOG("Loaded layout from cache: %s", url);
return m_loaded_layouts.Get(url_hash);
}
// Try and load texture!
UILayout* layout = Load_Without_Handle(url);
if (layout != NULL)
{
UILayoutHandle* handle = new UILayoutHandle(url, layout);
m_loaded_layouts.Set(url_hash, handle);
DBG_LOG("Loaded UI layout: %s", url);
return handle;
}
else
{
DBG_LOG("Failed to load UI layout: %s", url);
}
return NULL;
}
示例12: VPEMGR_init
int VPEMGR_init(void)
{
int rv;
pthread_attr_t attr;
int stacksize = 128 * KiBYTES;
LIST_INIT( &vpemgr_req_head );
rv = pthread_attr_init(&attr);
if (rv) {
DBG_LOG(MSG, MOD_VPEMGR, "pthread_attr_init() failed, rv=%d", rv);
return 0;
}
rv = pthread_attr_setstacksize(&attr, stacksize);
if (rv) {
DBG_LOG(MSG, MOD_VPEMGR,
"pthread_attr_setstacksize() failed, rv=%d", rv);
return 0;
}
if( pthread_create(&vpemgr_req_thread_id, &attr, vpemgr_req_func, NULL)) {
DBG_LOG(MSG, MOD_VPEMGR, "Failed to create thread %s VPEMGR Initialization unsuccessful", "");
return 0;
}
glob_vpemgr_tot_reqs=0;
glob_vpemgr_err_dropped=0;
return 1;
}
示例13: __trim
static void __trim(binpac_sink* sink, uint64_t rseq, void* user, hlt_exception** excpt, hlt_execution_context* ctx)
{
#ifdef DEBUG
if ( rseq != UINT64_MAX ) {
DBG_LOG("binpac-sinks", "trimming sink %p to rseq %" PRIu64, sink, rseq);
}
else {
DBG_LOG("binpac-sinks", "trimming sink %p to eod", sink);
}
#endif
__chunk* c = sink->first_chunk;
while ( c ) {
if ( c->rupper > rseq )
break;
if ( c->rupper < sink->cur_rseq && c->data )
__report_undelivered(sink, c->rseq, c->data, user, excpt, ctx);
__chunk* n = c->next;
__unlink_chunk(sink, c, excpt, ctx);
__delete_chunk(c, excpt, ctx);
c = n;
}
sink->trim_rseq = rseq;
}
示例14: Get_Compiled_Path
Atlas* AtlasResourceCompiler::Load_Compiled()
{
std::string compiled_path = Get_Compiled_Path();
Platform* platform = Platform::Get();
// Compile time.
DBG_LOG("Loading atlas resource '%s'.", compiled_path.c_str());
// Load configuration settings.
ConfigFile config;
if (!config.Load(compiled_path.c_str()))
{
DBG_LOG("Failed to load atlas, config file could not be found: '%s'", compiled_path.c_str());
return NULL;
}
// Load the compile atlas file.
Atlas* atlas = new Atlas();
if (!atlas->Load_Compiled_Config(&config))
{
return NULL;
}
DBG_LOG("Finished loading compiled atlas from '%s'.", compiled_path.c_str());
return atlas;
}
示例15: CreateProgram
GLuint CreateProgram(PP_Resource context, PPB_OpenGLES2* gl, const char* vs, const char* ps)
{
GLuint shaders[2];
GLuint program;
GLint status = 0;
shaders[0] = gl->CreateShader(context, GL_VERTEX_SHADER);
gl->ShaderSource(context, shaders[0], 1, &vs, 0);
gl->CompileShader(context, shaders[0]);
gl->GetShaderiv(context, shaders[0], GL_COMPILE_STATUS, &status);
if(!status)
{
char aszMessage[300];
char aszShaderLog[256];
gl->GetShaderInfoLog(context, shaders[0], 256, 0, aszShaderLog);
sprintf(aszMessage, DBG_LOG_PREFIX"Failed to vertex compile shader\n%s\n", aszShaderLog);
DBG_LOG(aszMessage);
}
shaders[1] = gl->CreateShader(context, GL_FRAGMENT_SHADER);
gl->ShaderSource(context, shaders[1], 1, &ps, 0);
gl->CompileShader(context, shaders[1]);
gl->GetShaderiv(context, shaders[1], GL_COMPILE_STATUS, &status);
if(!status)
{
char aszMessage[300];
char aszShaderLog[256];
gl->GetShaderInfoLog(context, shaders[1], 256, 0, aszShaderLog);
sprintf(aszMessage, DBG_LOG_PREFIX"Failed to pixel compile shader\n%s\n", aszShaderLog);
DBG_LOG(aszMessage);
}
program = gl->CreateProgram(context);
gl->AttachShader(context, program, shaders[0]);
gl->AttachShader(context, program, shaders[1]);
gl->BindAttribLocation(context, program, VA_POSITION_INDEX, "Position");
gl->BindAttribLocation(context, program, VA_TEXCOORD_INDEX, "TexCoords0");
gl->BindAttribLocation(context, program, VA_NORMAL_INDEX, "Normal");
gl->LinkProgram(context, program);
gl->GetProgramiv(context, program, GL_LINK_STATUS, &status);
if(!status)
{
DBG_LOG(DBG_LOG_PREFIX"Failed to link program\n");
}
return program;
}