hci_dump.c (1fd51e455535ccd9586ea82ed6c18bcee3dbd598) hci_dump.c (20ea11b9fd3c86b51ab9f4b1a2d6e56b292d6087)
1/*
2 * Copyright (C) 2009-2012 by Matthias Ringwald
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 222 unchanged lines hidden (view full) ---

231
232 default:
233 break;
234 }
235#endif
236}
237
238void hci_dump_log(const char * format, ...){
1/*
2 * Copyright (C) 2009-2012 by Matthias Ringwald
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 222 unchanged lines hidden (view full) ---

231
232 default:
233 break;
234 }
235#endif
236}
237
238void hci_dump_log(const char * format, ...){
239
240 if (dump_file < 0) return; // not activated yet
239 if (dump_file < 0) return; // not activated yet
241
242 va_list argptr;
243 va_start(argptr, format);
244#ifdef EMBEDDED
245 printf("LOG -- ");
246 vprintf(format, argptr);
247 printf("\n");
248#else
249 int len = vsnprintf(log_message_buffer, sizeof(log_message_buffer), format, argptr);
250 hci_dump_packet(LOG_MESSAGE_PACKET, 0, (uint8_t*) log_message_buffer, len);
251#endif
252 va_end(argptr);
253}
254
240 va_list argptr;
241 va_start(argptr, format);
242#ifdef EMBEDDED
243 printf("LOG -- ");
244 vprintf(format, argptr);
245 printf("\n");
246#else
247 int len = vsnprintf(log_message_buffer, sizeof(log_message_buffer), format, argptr);
248 hci_dump_packet(LOG_MESSAGE_PACKET, 0, (uint8_t*) log_message_buffer, len);
249#endif
250 va_end(argptr);
251}
252
253#ifdef __AVR__
254void hci_dump_log_P(PGM_P format, ...){
255 if (dump_file < 0) return; // not activated yet
256 va_list argptr;
257 va_start(argptr, format);
258 printf_P(PSTR("LOG -- "));
259 vfprintf_P(stdout, format, argptr);
260 printf_P(PSTR("\n"));
261 va_end(argptr);
262}
263#endif
264
255void hci_dump_close(){
256#ifndef EMBEDDED
257 close(dump_file);
258 dump_file = -1;
259#endif
260}
261
265void hci_dump_close(){
266#ifndef EMBEDDED
267 close(dump_file);
268 dump_file = -1;
269#endif
270}
271