int Debug::setWrapper(const Wrapper *wrapper) {

    wrapper_ = (Wrapper *) wrapper;
    setDebugLevel(((Debug *) wrapper)->debugLevel_);
    setThreadNumber(((Debug *) wrapper)->threadNumber_);
    return 0;
}
Exemplo n.º 2
0
int
main() {
    setDebugLevel(DEBUG_LEVEL_VERBOSE);

    struct thread_args args[NB_THREADS];
    pthread_t threads[NB_THREADS];

    int res=0;

    for (int i=0; i<NB_THREADS; i++) {
        args[i].fRunning = true;
        args[i].fCancellation = PTHREAD_CANCEL_DEFERRED;
        if ((res = pthread_create(&threads[i], 0, thread_function, &args[i]))) {
            debugError("Cannot set create thread %d %s\n", res, strerror(res));
            return -1;
        }
        debugOutput( DEBUG_LEVEL_VERBOSE, "created thread: %p\n", &args[i]);
    }


    SleepUsecRelative(RUNTIME_USECS);
    
    for (int i=0; i<NB_THREADS; i++) {
        debugOutput( DEBUG_LEVEL_VERBOSE, "Stop thread: %p\n", &args[i]);
        void* status;
        args[i].fRunning = false; // Request for the thread to stop
        pthread_join(threads[i], &status);
        debugOutput( DEBUG_LEVEL_VERBOSE, "Stopped thread: %p\n", &args[i]);
    }

}
Exemplo n.º 3
0
void setDebugLevelForTimeIndex(int index) {
  restoreDebugLevels();
  for (int i=0; i<(int)_schedule.size(); i++) {
    if (_schedule[i].first.first <= index && index <= _schedule[i].first.second) {
      setDebugLevel(_schedule[i].second);
    }
  }
}
Exemplo n.º 4
0
void
FFADODevice::setVerboseLevel(int l)
{
    debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l );
    setDebugLevel(l);
    m_DeviceMutex.setVerboseLevel(l);
    getConfigRom().setVerboseLevel(l);
}
Exemplo n.º 5
0
int main() {
    setDebugLevel(DEBUG_LEVEL_VERY_VERBOSE);
    printf("Cycle timer operation tests (incomplete)\n");
    
    /* TEST 1
     * check reconstruction of SYT RECEIVE timestamp
     *
     * The now_ctr has wrapped, while the cycle and syt have not
     *
     */

    #ifdef DEBUG
    uint32_t now_ctr = 0x140001DA;
    uint64_t now = CYCLE_TIMER_TO_TICKS(0x140001DA);
    unsigned int cycle = 7968;
    uint16_t syt = 0x583B;
    #endif
    
    debugOutput(DEBUG_LEVEL_VERBOSE,"NOW_CTR          : %08X (%03us %04uc %04ut)\n",
                          now_ctr,
                          (unsigned int)CYCLE_TIMER_GET_SECS(now_ctr),
                          (unsigned int)CYCLE_TIMER_GET_CYCLES(now_ctr),
                          (unsigned int)CYCLE_TIMER_GET_OFFSET(now_ctr));

    debugOutput(DEBUG_LEVEL_VERBOSE,"NOW              : %011llu (%03us %04uc %04ut)\n",
                          now,
                          (unsigned int)TICKS_TO_SECS(now),
                          (unsigned int)TICKS_TO_CYCLES(now),
                          (unsigned int)TICKS_TO_OFFSET(now));
    debugOutput(DEBUG_LEVEL_VERBOSE,"SYT              : %08X (%03us %04uc %04ut)\n",
                          syt,
                          (unsigned int)CYCLE_TIMER_GET_SECS(syt),
                          (unsigned int)CYCLE_TIMER_GET_CYCLES(syt),
                          (unsigned int)CYCLE_TIMER_GET_OFFSET(syt));
    debugOutput(DEBUG_LEVEL_VERBOSE,"CYCLE            : %uc\n",
                          cycle);
    #ifdef DEBUG
    uint64_t calc_ts = sytRecvToFullTicks(syt, cycle, now_ctr);
    #endif

    debugOutput(DEBUG_LEVEL_VERBOSE,"CALC_TS          : %011llu (%03us %04uc %04ut)\n",
                          calc_ts,
                          (unsigned int)TICKS_TO_SECS(calc_ts),
                          (unsigned int)TICKS_TO_CYCLES(calc_ts),
                          (unsigned int)TICKS_TO_OFFSET(calc_ts));

    
// BL: 1211722982: Debug (IsoHandler.cpp)[ 420] putPacket: received packet: length=168, channel=0, cycle=7968
// BL: 1211723031: Debug (cycletimer.h)[ 308] sytRecvToFullTicks: SYT=583B CY=7968 CTR=140001DA
// BL: 1211723037: Debug (StreamProcessor.cpp)[ 346] putPacket: RECV: CY=7968 TS=00245679163
// BL: 1211723043: Debug (AmdtpReceiveStreamProcessor.cpp)[ 135] processPacketData: STMP: 245679163ticks | syt_interval=8, tpf=557.254395
// BL: 1211723051: Debug (TimestampedBuffer.cpp)[1153] incrementFrameCounter:  nbframes: 8, m_update_period: 8
// BL: 1211723052: Debug (AmdtpTransmitStreamProcessor.cpp)[ 250] generatePacketHeader: Too early: CY=0254, TC=0257, CUT=0003, TST=00271126073 (0257), TSP=00271137849 (0261)
// BL: 1211723055: Debug (TimestampedBuffer.cpp)[1155] incrementFrameCounter:  tail TS:  270250705.174, next tail TS:  270255163.209
// BL: 1211723062: Debug (TimestampedBuffer.cpp)[1157] incrementFrameCounter:  new TS:  245679163.000, wrapped new TS:  245679163.000
//     

}
Exemplo n.º 6
0
void
PortManager::setVerboseLevel(int i)
{
    setDebugLevel(i);
    for ( PortVectorIterator it = m_Ports.begin();
      it != m_Ports.end();
      ++it )
    {
        (*it)->setVerboseLevel(i);
    }
}
Exemplo n.º 7
0
ColumnOpCompress1::ColumnOpCompress1(Log* logger)
{
	m_compressionType = 1;
   m_chunkManager = new ChunkManager();
   if (logger)
   {
		setDebugLevel( logger->getDebugLevel() );
		setLogger    ( logger );
   }
   m_chunkManager->fileOp(this);
}
Exemplo n.º 8
0
void
Container::setVerboseLevel(int l)
{
    setDebugLevel(l);
    for ( ElementVectorIterator it = m_Children.begin();
      it != m_Children.end();
      ++it )
    {
        (*it)->setVerboseLevel(l);
    }
    debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l );
}
Exemplo n.º 9
0
/**
 * Initialize Essentia and fill the AlgorithmFactories with the Algorithms.
 */
void init() {
  setDebugLevel(EUser1 | EUser2);

  E_DEBUG(EFactory, "essentia::init()");
  standard::AlgorithmFactory::init();
  standard::registerAlgorithm();
  streaming::AlgorithmFactory::init();
  streaming::registerAlgorithm();
  TypeMap::init();

  _initialized = true;
  E_DEBUG(EFactory, "essentia::init() ok!");
}
Exemplo n.º 10
0
static bool setupUserDefaults(
	LPSTR lpCmdLine,
	bool screenSaver,
	bool removableDrive)
{
	char *appName = "Travis Cobbs/LDView";
	char *sessionName;
	bool retValue = true;

	TCUserDefaults::setCommandLine(lpCmdLine);
	if (removableDrive)
	{
		if (!TCUserDefaults::setIniFile("LDView.ini"))
		{
			retValue = false;
		}
	}
	TCUserDefaults::setAppName(appName);
	// The language module needs to be loaded using LDView as the app name.  So
	// if we're running in screensaver mode, we'll take care of changing our
	// app name after that is done.
	loadLanguageModule();
	if (screenSaver)
	{
		appName = "Travis Cobbs/LDView Screen Saver";
		TCUserDefaults::setAppName(appName);
	}
#ifdef _DEBUG
	// Set the debug level before selecting a pref set.
	setDebugLevel((int)TCUserDefaults::longForKey(DEBUG_LEVEL_KEY, 1, false));
#endif // _DEBUG
	sessionName =
		TCUserDefaults::getSavedSessionNameFromKey(PREFERENCE_SET_KEY);
	if (sessionName && sessionName[0])
	{
		TCUserDefaults::setSessionName(sessionName, NULL, false);
	}
	delete sessionName;
	return retValue;
}
Exemplo n.º 11
0
void SDCLibrary2::startup(OSELib::LogLevel debugLevel) {
	if (!initialized) {
		initialized = true;
		setDebugLevel(debugLevel);
		log_notice([&]{ return "SDCLib version " + CURRENT_LIB_VERSION + " (C) 2018 SurgiTAIX AG"; });

		// init parser
        xercesc::XMLPlatformUtils::Initialize();

        // init interfaces management
        // TODO: implement IPv6
        for (const auto & nextIf : Poco::Net::NetworkInterface::list()) {
        	if (nextIf.supportsIPv4()
				&& nextIf.address().isUnicast()
				&& !nextIf.address().isLoopback()) {
        			m_availableNetworkInterfacesList.push_back(nextIf);
        	}
        }
	} else {
		log_error([&]{ return "SDCLib already initialized!"; });
	}
}
Exemplo n.º 12
0
int checkRunningCcd()
{
    LOG_ALWAYS("2014/05/29 PM6.15.");
    LOG_ALWAYS("Check ccd instance not present.");
    setDebugLevel(LOG_LEVEL_CRITICAL);  // Avoid confusing log where it gives error if ccd is not detected yet
    LOG_ALWAYS("after set debug level.");
    ccd::GetSystemStateInput request;
    LOG_ALWAYS("after get system state input.");
    request.set_get_players(true);
    ccd::GetSystemStateOutput response;
    LOG_ALWAYS("after get system state ouput.");
    int rv;
    LOG_ALWAYS("before CCDI get system state");
    rv = CCDIGetSystemState(request, response);
    LOG_ALWAYS("after CCDI get system state");
    resetDebugLevel();
    LOG_ALWAYS("after reset debug level");
    if (rv == CCD_OK) {
        LOG_ALWAYS("CCD is already present!\n");
    }
    return (rv == 0) ? -1 : 0;  // Only a success if CCDIGetSystemState failed.
}
Exemplo n.º 13
0
ColumnOpCompress0::ColumnOpCompress0(Log* logger)
{
   m_compressionType = 0;
   setDebugLevel( logger->getDebugLevel() );
   setLogger    ( logger );
}
Exemplo n.º 14
0
void
Element::setVerboseLevel(int l)
{
    setDebugLevel(l);
    debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l );
}
Exemplo n.º 15
0
int main(int argc, char **argv)
{
    int u, c;

    // Default values.
    arguments.verbose =  DEBUG_LEVEL_INFO;
    arguments.port = 0;
    arguments.channel = 0;
    arguments.channel2 = arguments.channel + 1;
    arguments.packetsize = 1024;
    arguments.buffersize = 64;
    arguments.interval = -1;
    arguments.startoncycle = -1;
    arguments.countdown = 4;
    arguments.printinterval = 100;
    arguments.rtprio = 0;

    // Parse our arguments; every option seen by `parse_opt' will
    // be reflected in `arguments'.
    if ( argp_parse ( &argp, argc, argv, 0, 0, &arguments ) ) {
        debugError("Could not parse command line\n" );
        return -1;
    }

    // fix up arguments
    if(arguments.interval < 0) {
        arguments.interval = arguments.buffersize / 2;
    } else if (arguments.interval*2 > arguments.buffersize) {
        arguments.interval = arguments.buffersize / 2;
    }

    setDebugLevel(arguments.verbose);
//     set_realtime_priority(10);

    debugOutput(DEBUG_LEVEL_INFO, 
            "ISO test:  %ld bytes/packet, %ld packets/interrupt...\n",
            arguments.packetsize, arguments.interval);

    // setup the connection using the arguments
#define MAX_NB_CONNECTIONS 8
    struct connection conn[MAX_NB_CONNECTIONS];

    int nb_connections = 0;
    if(conn_init(&conn[nb_connections], arguments.port,
                       arguments.buffersize,
                       arguments.interval,
                       arguments.packetsize,
                       arguments.channel,
                       arguments.startoncycle,
                       process_packet, NULL) != 0)
    {
        exit(-1);
    }
    nb_connections++;

    if(conn_init(&conn[nb_connections], arguments.port,
                       arguments.buffersize,
                       arguments.interval,
                       arguments.packetsize,
                       arguments.channel2,
                       arguments.startoncycle,
                       process_packet, NULL) != 0)
    {
        exit(-1);
    }
    nb_connections++;

    int status;

    debugOutput(DEBUG_LEVEL_INFO, "Start ISO receive...\n");
    // start reception
    for(c = 0; c < nb_connections; c++) {
        if(conn_start_iso(&conn[c]) != 0) {
            for(u = 0; u < nb_connections; u++) {
                conn_free(&conn[u]);
            }
            exit(-1);
        }
    }

    // present two views on the event
    union
    {
        char buf[4096];
        union fw_cdev_event e;
    } e;

    // read the packets that are sent using blocking I/O

    int nruns = arguments.countdown;
    __u64 front_tsps[nb_connections];
    int highest_at = 0;
    int ticks_per_frame = TICKS_PER_SECOND / 48000;
    int half_a_frame = ticks_per_frame / 2;

    do {
        debugOutput(DEBUG_LEVEL_VERBOSE, 
                    "Run %d\n", 
                    (int)(arguments.countdown - nruns));
        struct pollfd fds[nb_connections];
        int status;

        for(u = 0; u < nb_connections; u++) {
            fds[u].fd = conn[u].fd;
            fds[u].events = POLLIN;
        }

        status = poll ( fds, nb_connections, -1 );
        if(status < 0) {
            for(u = 0; u < nb_connections; u++) {
                conn_free(&conn[u]);
            }
            exit(-1);
        }

        for(c = 0; c < nb_connections; c++) {
            if(fds[c].revents & POLLIN ) {
                // read from the fd
                int nread = read ( conn[c].fd, &e, sizeof ( e ) );
                if ( nread < 1 ) {
                    debugError("Failed to read fd\n");
                    exit(-1);
                }

                // determine event type
                switch ( e.e.common.type )
                {
                    case FW_CDEV_EVENT_BUS_RESET:
                        debugError("BUS RESET\n");
        //                 goto out;
                        goto nextevent;
        
                    case FW_CDEV_EVENT_RESPONSE:
                        debugError("Event response\n");
                        goto out;
        
                    case FW_CDEV_EVENT_REQUEST:
                        debugError("Event request\n");
                        goto out;
        
                    case FW_CDEV_EVENT_ISO_INTERRUPT:
                        break;
                }

                if(1) {
                    // we have received an ISO interrupt
                    int npackets = e.e.iso_interrupt.header_length / conn[c].header_size;
                    debugOutput(DEBUG_LEVEL_VERBOSE,  
                            "ISO interrupt, header_len = %d, cycle = [%1ds, %4dc], " 
                            "received %d pkt\n", 
                            (int)e.e.iso_interrupt.header_length,
                            (int)(e.e.iso_interrupt.cycle >> 13) & 0x7,
                            (int)(e.e.iso_interrupt.cycle >> 0) & 0x1FFF,
                            npackets);
            
                    conn_consume(&conn[c], e.e.iso_interrupt.header, npackets);
                }
            }
        }
Exemplo n.º 16
0
int main(int argc, char **argv)
{
    size_t c;
    int status;

    // Default values.
    arguments.verbose =  DEBUG_LEVEL_INFO;
    arguments.port = 0;
    arguments.channel = 0;
    arguments.channel2 = arguments.channel + 1;
    arguments.packetsize = 1024;
    arguments.period_size = 512;
    arguments.nb_periods = 2;
    // number of extra frames to buffer on top of the
    // nb_periods x period_size. adds to the latency
    arguments.frame_slack = 0;
    // number of extra ISO packet descriptors to queue,
    // doesn't add to the latency.
    arguments.iso_slack = 0;

    arguments.startoncycle = -1;
    arguments.countdown = 4;
    arguments.printinterval = 100;
    arguments.rtprio = 0;

    // Parse our arguments; every option seen by `parse_opt' will
    // be reflected in `arguments'.
    if ( argp_parse ( &argp, argc, argv, 0, 0, &arguments ) ) {
        debugError("Could not parse command line\n" );
        return -1;
    }

    // utility file descriptor
    char *device = NULL;
    if(asprintf(&device, "/dev/fw%zd", arguments.port) < 0) {
        debugError("Failed create device string\n");
        exit(-1);
    }

    // open the specified port
    debugOutput(DEBUG_LEVEL_INFO, "Open device %s...\n", device);

    int util_fd = open( device, O_RDWR );
    if(util_fd < 0) {
        debugError("Failed to open %s\n", device);
        free(device);
        exit(-1);
    }
    free(device);

    setDebugLevel(arguments.verbose);

    // AM824 settings
    struct am824_settings stream_settings;
    stream_settings.syt_interval = 8;

    // connection settings
    struct stream_settings settings;
    settings.type = STREAM_TYPE_RECEIVE;
    settings.channel = 0;
    settings.port = arguments.port;
    settings.max_packet_size = arguments.packetsize;
    settings.client_data = &stream_settings;
    settings.process_header  = NULL;
    settings.process_payload = receive_am824_packet_data;
    settings.packet_size_for_sync = FRAMES_PER_PACKET;

    // setup the streamer
    streamer_t strm = streamer_new();
    if(strm == NULL) {
        debugError("Could not allocate streamer\n");
        exit(-1);
    }
    __u32 conn_ids[16];

    if(streamer_init(strm, arguments.port,
                     arguments.period_size,
                     arguments.nb_periods,
                     arguments.frame_slack,
                     arguments.iso_slack,
                     FRAMES_PER_SECOND) < 0) {
        debugError("Failed to init streamer\n");
        close(util_fd);
        exit(-1);
    }

#if 0
    settings.channel = arguments.channel;
    settings.type = STREAM_TYPE_TRANSMIT;
    settings.process_header = NULL;
    settings.process_payload = transmit_am824_packet_data;
#else
    settings.channel = 0;
    settings.type = STREAM_TYPE_RECEIVE;
    settings.process_header = NULL;
    settings.process_payload = receive_am824_packet_data;
#endif

    status = streamer_add_stream(strm, &settings);
    if(status < 0) {
        debugError("Failed to add connection\n");
        streamer_free(strm);
        close(util_fd);
        exit(-1);
    }
    conn_ids[0] = status;

#if 1
    settings.channel     = arguments.channel2;
    settings.type        = STREAM_TYPE_TRANSMIT;
    settings.process_header = NULL;
    settings.process_payload = transmit_am824_packet_data;
#else
    settings.channel = 1;
    settings.type = STREAM_TYPE_RECEIVE;
    settings.process_header = NULL;
    settings.process_payload = receive_am824_packet_data;
#endif
    status = streamer_add_stream(strm, &settings);
    if(status < 0) {
        debugError("Failed to add connection\n");
        streamer_free(strm);
        close(util_fd);
        exit(-1);
    }
    conn_ids[1] = status;

#if 0
    settings.channel = 12;
    settings.type = STREAM_TYPE_TRANSMIT;
    settings.process_header = NULL;
    settings.process_payload = transmit_am824_packet_data;
#else
    settings.channel = arguments.channel;
    settings.type = STREAM_TYPE_RECEIVE;
    settings.process_header = NULL;
    settings.process_payload = receive_am824_packet_data;
#endif
    status = streamer_add_stream(strm, &settings);
    if(status < 0) {
        debugError("Failed to add connection\n");
        streamer_free(strm);
        close(util_fd);
        exit(-1);
    }
    conn_ids[2] = status;

    streamer_start_connection(strm, conn_ids[0], -1);
    streamer_set_sync_connection(strm, conn_ids[0]);

    int nruns = arguments.countdown;

    // start the streamer
    if(streamer_start(strm) < 0) {
        debugError("Could not start streamer\n");
        return -1;
    }

    do {
//         debugOutput(DEBUG_LEVEL_INFO,
        debugWarning(
                     ">>>>>>>>>> Run %d <<<<<<<<<<\n", 
                     (int)(arguments.countdown - nruns));
        if(arguments.countdown - nruns == 10) {
            streamer_start_connection(strm, conn_ids[1], -1);
        }
        if(arguments.countdown - nruns == 20) {
            streamer_start_connection(strm, conn_ids[2], -1);
        }
        if(arguments.countdown - nruns == 30) {
            settings.channel = 3;
            settings.type = STREAM_TYPE_RECEIVE;
            settings.process_header = NULL;
            settings.process_payload = receive_am824_packet_data;
            status = streamer_add_stream(strm, &settings);
            if(status < 0) {
                debugError("Failed to add connection\n");
                streamer_free(strm);
                close(util_fd);
                exit(-1);
            }
            conn_ids[3] = status;
        }
        if(arguments.countdown - nruns == 40) {
            streamer_start_connection(strm, conn_ids[3], -1);
        }
        if(arguments.countdown - nruns == 50) {
            streamer_set_sync_connection(strm, conn_ids[3]);
        }

        /* ============================== *
         *             WAIT               *
         * ============================== */
        if(streamer_wait_for_period(strm) < 0) {
            debugError("Failed to wait for period\n");
            goto out;
        }

        /* ============================== *
         *             READ               *
         * ============================== */
        streamer_read_frames(strm);

        /* ============================== *
         *             PROCESS            *
         * ============================== */

        /* ============================== *
         *             WRITE              *
         * ============================== */
        streamer_write_frames(strm);

        /* ============================== *
         *             REQUEUE            *
         * ============================== */

        if(streamer_queue_next_period(strm) < 0) {
            debugError("queue failed\n");
            goto out;
        }
    } while(--nruns);

out:

    if(streamer_stop(strm) < 0) {
        debugError("Could not stop streamer\n");
        return -1;
    }

    streamer_free(strm);

    close(util_fd);
    return 0;
}
Exemplo n.º 17
0
void
CycleTimerHelper::setVerboseLevel(int l)
{
    setDebugLevel(l);
}
Exemplo n.º 18
0
void
Watchdog::setVerboseLevel(int i)
{
    setDebugLevel(i);
}
Exemplo n.º 19
0
int setup_stream_test(int argc, const char* argv[])
{
    int rv = 0;

    if (checkHelp(argc, argv)) {
        std::cout << "SetupStreamTest [-c collectionid] [-D testfilesfolder] [-d dumpfile [-M dumpCountMax]] [-f filterCategory 0|1|2|3]" << std::endl;
        std::cout << "  collectionid    = Collection ID. Default is \"streamtestcollection\"" << std::endl;
        std::cout << "  testfilesfolder = Folder containing test files. Ignored on client." << std::endl;
        std::cout << "  dumpfile        = Dump URLs to this file." << std::endl;
        std::cout << "  dumpCountMax    = Dump at most this many files." << std::endl;
        std::cout << "  filterCategory  = 0 - All(Disabled) | 1 - Music | 2 - Photo | 3 - Music&Photo(Disabled) | 4 - Video | 5 - Music&Video(Disabled) | 6 - Photo&Video(Disabled). Default is 1 - dump music." << std::endl;
        return 0;
    }

    std::string collectionid;
    std::string testfilesfolder;
    std::string dumpfile;
    int dumpCountMax = -1;  // meaning no limit
    bool downloadMusic = true;
    bool downloadPhoto = false;
    bool downloadVideo = false;
    media_metadata::CatalogType_t catType = media_metadata::MM_CATALOG_MUSIC;
    collectionid.assign("streamtestcollection");  // default collection ID

    setDebugLevel(LOG_LEVEL_INFO);

    for (int i = 1; i < argc; i++) {
        if (argv[i][0] == '-') {
            switch (argv[i][1]) {
            case 'c':
                if (i + 1 < argc) {
                    collectionid.assign(argv[++i]);
                }
                break;
            case 'D':
                if (i + 1 < argc) {
                    testfilesfolder.assign(argv[++i]);
                }
                break;
            case 'd':
                if (i + 1 < argc) {
                    dumpfile.assign(argv[++i]);
                }
                break;
            case 'M':
                if (i + 1 < argc) {
                    dumpCountMax = atoi(argv[++i]);
                }
                break;
            case 'f':
                if(i + 1 < argc) {
                    if(atoi(argv[i+1]) == 0) {
                        downloadMusic = true;
                        downloadPhoto = true;
                        downloadVideo = true;
                        LOG_ERROR("Not supported");
                        return -1;
                    }
                    else if(atoi(argv[i+1]) == 1) {
                        downloadMusic = true;
                        downloadPhoto = false;
                        downloadVideo = false;
                        catType = media_metadata::MM_CATALOG_MUSIC;
                    }
                    else if(atoi(argv[i+1]) == 2) {
                        downloadMusic = false;
                        downloadPhoto = true;
                        downloadVideo = false;
                        catType = media_metadata::MM_CATALOG_PHOTO;
                    }
                    else if(atoi(argv[i+1]) == 3) {
                        downloadMusic = true;
                        downloadPhoto = true;
                        downloadVideo = false;
                        LOG_ERROR("Not supported");
                        return -1;
                    }
                    else if(atoi(argv[i+1]) == 4) {
                        downloadMusic = false;
                        downloadPhoto = false;
                        downloadVideo = true;
                        catType = media_metadata::MM_CATALOG_VIDEO;
                    }
                    else if(atoi(argv[i+1]) == 5) {
                        downloadMusic = true;
                        downloadPhoto = false;
                        downloadVideo = true;
                        LOG_ERROR("Not supported");
                        return -1;
                    }
                    else {
                        downloadMusic = false;
                        downloadPhoto = true;
                        downloadVideo = true;
                        LOG_ERROR("Not supported");
                        return -1;
                    }
                }
                break;
            default:
                LOG_ERROR("Unknown option %s", argv[i]);
                return -2;
            }
        }
    }

    u64 userId = 0;
    rv = getUserIdBasic(&userId);
    if (rv != 0) {
        LOG_ERROR("Failed to get user ID: %d", rv);
        return rv;
    }

    u64 deviceId = 0;
    rv = getDeviceId(&deviceId);
    if (rv != 0) {
        LOG_ERROR("Failed to get device ID: %d", rv);
        return rv;
    }

    if (!testfilesfolder.empty()) {
        if (isCloudpc(userId, deviceId)) {
            rv = setup_stream_test_create_metadata(userId,
                                                   deviceId,
                                                   catType,
                                                   collectionid,
                                                   testfilesfolder);
        }
        else {
            LOG_WARN("-D ignored on client PC");
        }
    }

    if (!dumpfile.empty()) {
        rv = setup_stream_test_write_dumpfile(userId,
                                              deviceId,
                                              collectionid,
                                              dumpfile,
                                              downloadMusic,
                                              downloadPhoto,
                                              downloadVideo,
                                              dumpCountMax);
    }

    resetDebugLevel();

    return rv;
}
Exemplo n.º 20
0
bool LibMuttng::setDebugLevel (Option* option) {
  (void) option;
  return setDebugLevel(DebugLevel);
}
Exemplo n.º 21
0
void
RemotePluginServer::dispatchControlEvents()
{    
    RemotePluginOpcode opcode = RemotePluginNoOpcode;
    static float *parameterBuffer = 0;

    tryRead(m_controlRequestFd, &opcode, sizeof(RemotePluginOpcode));

    switch (opcode) {

    case RemotePluginGetVersion:
	writeFloat(m_controlResponseFd, getVersion());
	break;

    case RemotePluginGetName:
	writeString(m_controlResponseFd, getName());
	break;

    case RemotePluginGetMaker:
	writeString(m_controlResponseFd, getMaker());
	break;
    
    case RemotePluginTerminate:
	terminate();
	break;
    
    case RemotePluginGetInputCount:
	m_numInputs = getInputCount();
	writeInt(m_controlResponseFd, m_numInputs);
	break;

    case RemotePluginGetOutputCount:
	m_numOutputs = getOutputCount();
	writeInt(m_controlResponseFd, m_numOutputs);
	break;

    case RemotePluginGetParameterCount:
	writeInt(m_controlResponseFd, getParameterCount());
	break;
	
    case RemotePluginGetParameterName:
	writeString(m_controlResponseFd, getParameterName(readInt(m_controlRequestFd)));
	break;
    
    case RemotePluginGetParameter:
	writeFloat(m_controlResponseFd, getParameter(readInt(m_controlRequestFd)));
	break;
    
    case RemotePluginGetParameterDefault:
	writeFloat(m_controlResponseFd, getParameterDefault(readInt(m_controlRequestFd)));
	break;

    case RemotePluginGetParameters:
    {
	if (!parameterBuffer) {
	    parameterBuffer = new float[getParameterCount()];
	}
	int p0 = readInt(m_controlRequestFd);
	int pn = readInt(m_controlRequestFd);
	getParameters(p0, pn, parameterBuffer);
	tryWrite(m_controlResponseFd, parameterBuffer, (pn - p0 + 1) * sizeof(float));
	break;
    }

    case RemotePluginHasMIDIInput:
    {
	bool m = hasMIDIInput();
	tryWrite(m_controlResponseFd, &m, sizeof(bool));
	break;
    }
       
    case RemotePluginGetProgramCount:
	writeInt(m_controlResponseFd, getProgramCount());
	break;

    case RemotePluginGetProgramName:
	writeString(m_controlResponseFd, getProgramName(readInt(m_controlRequestFd)));
	break;

    case RemotePluginIsReady:
    {
	if (!m_shm) sizeShm();
	bool b(isReady());
	std::cerr << "isReady: returning " << b << std::endl;
	tryWrite(m_controlResponseFd, &b, sizeof(bool));
    }

    case RemotePluginSetDebugLevel:
    {
	RemotePluginDebugLevel newLevel = m_debugLevel;
	tryRead(m_controlRequestFd, &newLevel, sizeof(RemotePluginDebugLevel));
	setDebugLevel(newLevel);
	m_debugLevel = newLevel;
	break;
    }

    case RemotePluginWarn:
    {
	bool b = warn(readString(m_controlRequestFd));
	tryWrite(m_controlResponseFd, &b, sizeof(bool));
	break;
    }

    case RemotePluginShowGUI:
    {
	showGUI(readString(m_controlRequestFd));
	break;
    }

    case RemotePluginHideGUI:
    {
	hideGUI();
	break;
    }

    //Deryabin Andrew: vst chunks support
    case RemotePluginGetVSTChunk:
    {
        std::vector<char> chunk = getVSTChunk();
        writeRaw(m_controlResponseFd, chunk);
        break;
    }

    case RemotePluginSetVSTChunk:
    {
        std::vector<char> chunk = readRaw(m_controlRequestFd);
        setVSTChunk(chunk);
        break;
    }
    //Deryabin Andrew: vst chunks support: end code

    case RemotePluginNoOpcode:
	break;

    case RemotePluginReset:
	reset();
	break;

    default:
	std::cerr << "WARNING: RemotePluginServer::dispatchControlEvents: unexpected opcode "
		  << opcode << std::endl;
    }
}
Exemplo n.º 22
0
bool
AVCCommand::setVerbose( int verboseLevel )
{
    setDebugLevel(verboseLevel);
    return true;
}
Exemplo n.º 23
0
int main(int argc, char* argv[]) {

	Config config = (Config) {
		BARCODE_STD,
		BAR_CHAR,
		SPACE_BAR,
		BAR_WIDTH,
		0,
		0
	};

	int last = parseArguments(argc, argv, &config);

	setDebugLevel(config.debug_level);

	if (last >= argc) {
		return 2;
	}
	debug(LOG_DEBUG,"to barcode: %s\n",argv[last]);

	struct Barcode_Item *bc = Barcode_Create(argv[last]);
	if (!bc) {
		return 1;
	}

	unsigned int encoding = find_encoding(config.encoding);

	debug(LOG_DEBUG, "encoding: %s: %d\n", config.encoding, encoding);

	if (!config.checksum) {
		debug(LOG_DEBUG, "encode without checksum\n");
		encoding |= BARCODE_NO_CHECKSUM;
	}

	int status = Barcode_Encode(bc, encoding);

	if (status < 0) {
		printf("Encoding failed: error %s\n", strerror(bc->error));
		return 4;
	}


	int i = 0;
	int j = 0;
	char* output = bc->partial;

	debug(LOG_DEBUG,"textinfo: %s\nascii: %s\npartial: %s\n", bc->textinfo, bc->ascii, bc->partial);

	unsigned int flag = 0;
	char c = config.bar;
	int num = 0;
	int k = 0;
	while (output[i] != 0) {

		if (flag) {
			c = config.bar;	
		} else {
			c = config.space;
		}


		if (isdigit(output[i])) {
			num = output[i] - '0';
		} else {
			num = output[i] - 96;
		}

		for (k = 0; k < num * config.width; k++) {
			printf("%c", c);
		}

		i++;
		flag = !flag;
	}
	printf("\n");

	Barcode_Delete(bc);

	return 0;
}
Exemplo n.º 24
0
void kDebug::setDebugLevel(string level)
{
	if (level=="None") setDebugLevel(DL_NONE);
	else if (level=="High") setDebugLevel(DL_HIGH);
	else if (level=="Low") setDebugLevel(DL_LOW);	
}
Exemplo n.º 25
0
void
EfcCmd::setVerboseLevel(int l)
{
    setDebugLevel(l);
}