Exemple #1
0
void FKeyBindings::SetBinds(const FBinding *binds)
{
	while (binds->Key)
	{
		DoBind (binds->Key, binds->Bind);
		binds++;
	}
}
Exemple #2
0
/*
 * prepare "bind" channel information for the name service
 * note: should be called before name service invocation
 */
static void PrepareBind(const struct ChannelDesc *channel)
{
  struct ChannelConnection *record;
  static uint16_t port = LOWEST_AVAILABLE_PORT;
  int result = 1;

  assert(channel != NULL);

  /* update netlist with the connection info */
  StoreChannelConnectionInfo(channel);

  /* if no name service is available just use given url and return */
  if(!NameServiceSet())
  {
    result = DoBind(channel);
    ZLOGFAIL(result != 0, EFAULT, "cannot bind %s", channel->alias);
    return;
  }

  record = GetChannelConnectionInfo(channel);
  assert(record != NULL);

  /* in case channel has port assigned (full url) bind it and return */
  if(record->port != 0)
  {
    result = DoBind(channel);
    ZLOGFAIL(result != 0, EFAULT, "cannot bind %s", channel->alias);
    return;
  }

  /*
   * if channel does not have port pick up the port in the loop
   * todo(d'b): check upcoming zmq version for port 0 binding
   */
  assert(record != NULL);
  for(;port >= LOWEST_AVAILABLE_PORT; ++port)
  {
    record->port = port;
    result = DoBind(channel);
    if(result == 0) break;
  }

  ZLOGFAIL(result != 0, EFAULT ,"cannot get port to bind %s", channel->alias);
  ZLOGS(LOG_DEBUG, "host = %u, port = %u", record->host, record->port);
}
Exemple #3
0
BluetoothMap::BluetoothMap(
    /* [in] */ IContext* context,
    /* [in] */ IBluetoothProfileServiceListener* l)
{
    if (DBG) Logger::D(TAG, "Create BluetoothMap proxy object");
    mContext = context;
    mServiceListener = l;
    mAdapter = CBluetoothAdapter::GetDefaultAdapter();
    AutoPtr<IIBluetoothManager> mgr = ((CBluetoothAdapter*)mAdapter.Get())->GetBluetoothManager();
    if (mgr != NULL) {
        //try {
        mgr->RegisterStateChangeCallback(mBluetoothStateChangeCallback);
        //} catch (RemoteException e) {
        //    Logger::E(TAG,"",e);
        //}
    }
    Boolean bind;
    DoBind(&bind);
}
BluetoothA2dpSink::BluetoothA2dpSink(
    /* [in] */ IContext* context,
    /* [in] */ IBluetoothProfileServiceListener* l)
{
    mContext = context;
    mServiceListener = l;
    mAdapter = CBluetoothAdapter::GetDefaultAdapter();
    AutoPtr<IIBluetoothManager> mgr = ((CBluetoothAdapter*)mAdapter.Get())->GetBluetoothManager();
    if (mgr != NULL) {
        //try {
        mgr->RegisterStateChangeCallback(mBluetoothStateChangeCallback);
        //} catch (RemoteException e) {
        //    Log.e(TAG,"",e);
        //}
    }


    Boolean bindResult;
    DoBind(&bindResult);
}