当前位置: 首页>>代码示例>>Java>>正文


Java AnyObject类代码示例

本文整理汇总了Java中com.aldebaran.qi.AnyObject的典型用法代码示例。如果您正苦于以下问题:Java AnyObject类的具体用法?Java AnyObject怎么用?Java AnyObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AnyObject类属于com.aldebaran.qi包,在下文中一共展示了AnyObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testInteger

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public static void testInteger(AnyObject proxy)
{
  Integer answer = null;

  try
  {
    answer = proxy.<Integer>call("answer", 41).get();
  } catch (Exception e)
  {
    System.out.println("Error calling answer() :" + e.getMessage());
    return;
  }

  if (answer == null)
    System.out.println("Answer is null :(");
  else
    System.out.println("AnswerInteger : " + answer);
}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:19,代码来源:App.java

示例2: testMap

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public static void testMap(AnyObject proxy)
{
  Map<Integer, Boolean> abacus = new Hashtable<Integer, Boolean>();
  Map<Integer, Boolean> answer = null;

  abacus.put(1, false);
  abacus.put(2, true);
  abacus.put(4, true);

  try
  {
    answer = proxy.<Hashtable<Integer, Boolean> >call("abacus", abacus).get();
  }
  catch (Exception e)
  {
    System.out.println("Error calling abacus() :" + e.getMessage());
    return;
  }

  System.out.println("abacus : " + answer);
}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:22,代码来源:App.java

示例3: testList

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public static void testList(AnyObject proxy)
{
  ArrayList<Integer> positions = new ArrayList<Integer>();
  ArrayList<Integer> answer = null;

  positions.add(40);
  positions.add(3);
  positions.add(3);
  positions.add(2);

  try
  {
    answer = proxy.<ArrayList<Integer> >call("echoIntegerList", positions).get();
  } catch (Exception e)
  {
    System.out.println("Error calling echoIntegerList() :" + e.getMessage());
    return;
  }

  System.out.println("list : " + answer);
}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:22,代码来源:App.java

示例4: run

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public void run(String[] args) throws Exception {
	String url = "tcp://nao.local:9559";
	if (args.length == 1) {
		url = args[0];
	}
	String[] appArgs = { "--qi-url", url };
	Application application = new Application(appArgs);
	Session session = new Session();
	Future<Void> fut = session.connect(url);
	fut.get(1, TimeUnit.SECONDS);
	tts = session.service("ALTextToSpeech").get();
	callback = new CallBack(tts);
	memory = session.service("ALMemory").get();
	AnyObject subscriber = (AnyObject) memory.call("subscriber",
			"FrontTactilTouched").get();
	subscriber.connect("signal::(m)", "onTouch::(m)", callback);
	application.run();

}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:20,代码来源:ReactToEvents.java

示例5: main

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	String address = "tcp://127.0.0.1:9559";
	Session session = new Session();
	QiService service = new HelloService();
	DynamicObjectBuilder objectBuilder = new DynamicObjectBuilder();
	objectBuilder.advertiseMethod("greet::s(s)", service, "Greet the caller");
	AnyObject object = objectBuilder.object();
	service.init(object);

	System.out.println("Connecting to: " + address);
	Future<Void> fut = session.connect(address);
	fut.get(1, TimeUnit.SECONDS);

	System.out.println("Registering hello service");
	session.registerService("hello", objectBuilder.object());

	while(true) {
		Thread.sleep(1);
	}
}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:21,代码来源:App.java

示例6: getNaoqiType

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
/**
 * Get the equivalence between Java type and naoqi type
 * @param tClass The java class of type you want to convert
 * @return the Naoqi type
 * */
public String getNaoqiType(Class<?> tClass) {

	if(tClass == String.class)
		return "s";
	if(tClass == Integer.class)
		return "i";
	if(tClass == Character.class)
		return "c";
	if(tClass == Void.class)
		return "v";
	if(tClass == AnyObject.class)
		return "o";
	if(tClass == Boolean.class)
		return "b";
	if(tClass == Float.class)
		return "f";
	if(tClass == Long.class)
		return "l";
	else return "m";
}
 
开发者ID:aldebaran,项目名称:jnaoqi,代码行数:26,代码来源:ALProxy.java

示例7: createObject

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public AnyObject createObject()
{
  DynamicObjectBuilder ob = new DynamicObjectBuilder();

  try {
    ob.advertiseSignal("fire::(i)");

    ob.advertiseMethod("reply::s(s)", this, "Concatenate given parameter with 'bim !'");
    ob.advertiseMethod("answer::s()", this, "return '42 !'");
    ob.advertiseMethod("add::i(iii)", this, "Sum given parameters and return computed value");

    ob.advertiseProperty("name", String.class);
    ob.advertiseProperty("uid", Integer.class);

  } catch (Exception e1) {
    System.out.println("Cannot advertise methods and signals : " + e1.getMessage());
    return null;
  }

  AnyObject ro = ob.object();

  try {
    ro.setProperty("name", "foo");
    ro.setProperty("uid", 42);
  } catch (Exception e) {
    System.out.println("Cannot set properties : " + e.getMessage());
  }

  return ro;
}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:31,代码来源:ReplyService.java

示例8: testEvent

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public void testEvent(AnyObject proxy)
{
  try {
    proxy.connect("fire", "onFire", this);
  } catch (Exception e1) {
    System.out.println("Cannot connect onFire callback to fire event");
  }
  try {
    proxy.call("triggerFireEvent", 42);
  } catch (CallError e) {
    System.out.println("Error triggering Fire event : " + e.getMessage());
  }
}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:14,代码来源:EventTester.java

示例9: testBoolean

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public static void testBoolean(AnyObject proxy)
{
  Boolean answer = null;

  try
  {
    answer = proxy.<Boolean>call("answerBool", false).get();
  } catch (Exception e)
  {
    System.out.println("Error calling answerBool() :" + e.getMessage());
    return;
  }

  System.out.println("AnswerBool : " + answer);
}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:16,代码来源:App.java

示例10: testAdd

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public static void testAdd(AnyObject proxy)
{
  Integer answer = null;

  try
  {
    answer = proxy.<Integer>call("add", 40, 2).get();
  } catch (Exception e)
  {
    System.out.println("Error calling add() :" + e.getMessage());
    return;
  }

  System.out.println("add : " + answer);
}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:16,代码来源:App.java

示例11: testString

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public static void testString(AnyObject proxy)
{
  String  str = null;

  try
  {
    str = proxy.<String>call("reply", "plaf").get();
  } catch (Exception e)
  {
    System.out.println("Error calling reply() :" + e.getMessage());
    return;
  }

  System.out.println("AnswerString : " + str);
}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:16,代码来源:App.java

示例12: testObject

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public static void testObject(AnyObject proxy) throws InterruptedException, ExecutionException
{
  AnyObject ro = null;
  try
  {
    ro = proxy.<AnyObject>call("createObject").get();
  } catch (Exception e)
  {
    System.out.println("Call failed: " + e.getMessage());
    return;
  }

  String prop = (String) ro.<String>property("name").get();
  System.out.println("Property : " + prop);
}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:16,代码来源:App.java

示例13: unsubscribeToEvent

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
/**
 * Unsubscribe to an event giving is subscription id
 * @param eventID id of the event subscription
 * */
public void unsubscribeToEvent(long eventID) throws InterruptedException, CallError {
	AnyObject subscriber = subscribers.get(eventID);
	if (subscriber != null) {
		subscriber.disconnect(eventID);
		subscribers.remove(eventID);
	}
}
 
开发者ID:aldebaran,项目名称:jnaoqi,代码行数:12,代码来源:ALMemoryHelper.java

示例14: unsubscribeAllEvents

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
/**
 * Unsubscribe to all events attached to this proxy
 * */
public void unsubscribeAllEvents() throws InterruptedException, CallError {
	for (Map.Entry<Long, AnyObject> entry : subscribers.entrySet()) {
		entry.getValue().disconnect(entry.getKey());
		subscribers.remove(entry.getKey());
	}
}
 
开发者ID:aldebaran,项目名称:jnaoqi,代码行数:10,代码来源:ALMemoryHelper.java

示例15: CallBack

import com.aldebaran.qi.AnyObject; //导入依赖的package包/类
public CallBack(AnyObject tts) {
	this.tts = tts;
}
 
开发者ID:aldebaran,项目名称:libqi-java,代码行数:4,代码来源:ReactToEvents.java


注:本文中的com.aldebaran.qi.AnyObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。