static EmberStatus startScan(uint8_t purpose)
{
  EmberStatus status = EMBER_INVALID_CALL;
#ifdef EMBER_AF_PLUGIN_ZLL_COMMISSIONING_LINK_INITIATOR
  if (touchLinkInProgress()) {
    emberAfAppPrintln("%pTouch linking in progress", "Error: ");
  } else {
    emberAfZllSetInitialSecurityState();
    setProfileInteropState();
    channel = emGetLogicalChannel();
    status = emberZllStartScan(getChannelMask(purpose),
                               EMBER_AF_PLUGIN_ZLL_COMMISSIONING_SCAN_POWER_LEVEL,
                               ((emAfCurrentZigbeeProNetwork->nodeType
                                 == EMBER_COORDINATOR)
                                ? EMBER_ROUTER
                                : emAfCurrentZigbeeProNetwork->nodeType));
    if (status == EMBER_SUCCESS) {
      flags = purpose;
    } else {
      emberAfAppPrintln("%p%p%p0x%x",
                        "Error: ",
                        "Touch linking failed: ",
                        "could not start scan: ",
                        status);
    }
  }
#endif //EMBER_AF_PLUGIN_ZLL_COMMISSIONING_LINK_INITIATOR
  return status;
}
Beispiel #2
0
SLresult AudioOutput::createAudioPlayer(int channels, int accompanySampleRate) {
    SLDataLocator_AndroidSimpleBufferQueue dataSourceLocator = {
            SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, // locator type
            1 // buffer count
    };
    SLuint32 samplesPerSec = (SLuint32)getSLSampleRate(accompanySampleRate);
    SLuint32 channelMask = (SLuint32)getChannelMask(channels);
    SLDataFormat_PCM dataSourceFormat = {
            SL_DATAFORMAT_PCM, // format type
            (SLuint32)channels, // channel count
            samplesPerSec, // samples per second in millihertz
            SL_PCMSAMPLEFORMAT_FIXED_16, // bits per sample
            SL_PCMSAMPLEFORMAT_FIXED_16, // container size
            channelMask, // channel mask
            SL_BYTEORDER_LITTLEENDIAN // endianness
    };

    // Data source is a simple buffer queue with PCM format
    SLDataSource dataSource = {
            &dataSourceLocator, // data locator
            &dataSourceFormat // data format
    };

    // Output mix locator for data sink
    SLDataLocator_OutputMix dataSinkLocator = {
            SL_DATALOCATOR_OUTPUTMIX, // locator type
            outputMixObject // output mix
    };

    // Data sink is an output mix
    SLDataSink dataSink = {
            &dataSinkLocator, // locator
            0 // format
    };

    // Interfaces that are requested
    SLInterfaceID interfaceIds[] = {
            SL_IID_BUFFERQUEUE
    };

    // Required interfaces. If the required interfaces
    // are not available the request will fail
    SLboolean requiredInterfaces[] = {
            SL_BOOLEAN_TRUE // for SL_IID_BUFFERQUEUE
    };

    // Create audio player object
    return (*engineEngine)->CreateAudioPlayer(engineEngine, &audioPlayerObject,
                                              &dataSource, &dataSink,
                                              sizeof(interfaceIds)/ sizeof(interfaceIds[0]),
                                              interfaceIds, requiredInterfaces);
}
Beispiel #3
0
 void fmt::toPrettyString(std::ostream &o, size_t indent) const{
   o << std::string(indent, ' ') << "[" << getType() << "] (" << (getPayloadSize() + 8)
     << "b):" << std::endl;
   indent += 1;
   o << std::string(indent, ' ') << "Codec: " << getCodec() << " (" << getFormat() << ")"
     << std::endl;
   o << std::string(indent, ' ') << "Channels: " << getChannels() << std::endl;
   o << std::string(indent, ' ') << "Sample rate: " << getHz() << "Hz" << std::endl;
   o << std::string(indent, ' ') << "Bytes/s: " << getBPS() << std::endl;
   o << std::string(indent, ' ') << "Block size: " << getBlockSize() << " bytes" << std::endl;
   o << std::string(indent, ' ') << "Sample size: " << getSize() << " bits" << std::endl;
   if (getExtLen()){
     o << std::string(indent, ' ') << "-- extended " << getExtLen() << "bytes --" << std::endl;
     if (getExtLen() >= 2){
       o << std::string(indent, ' ') << "Valid bits: " << getValidBits() << std::endl;
     }
     if (getExtLen() >= 6){
       o << std::string(indent, ' ') << "Channel mask: " << getChannelMask() << std::endl;
     }
     if (getExtLen() >= 22){
       o << std::string(indent, ' ') << "GUID: " << getGUID() << std::endl;
     }
   }
 }