00001 00009 package com.rosalfred.core.ia; 00010 00011 import org.ros.node.ConnectedNode; 00012 import org.ros.node.topic.Publisher; 00013 00014 import com.rosalfred.core.ia.rivescript.RiveScript; 00015 00016 import smarthome_comm_msgs.Command; 00017 00018 00024 public class RosRiveScript extends RiveScript { 00025 00026 private final IaNode iaNode; 00027 private final RsContext rsutils; 00028 00029 public RosRiveScript(IaNode iaNode, boolean debug) { 00030 super(debug); 00031 00032 this.iaNode = iaNode; 00033 this.rsutils = new RsContext(this); 00034 } 00035 00036 public ConnectedNode getNode() { 00037 return this.iaNode.connectedNode; 00038 } 00039 00043 public Publisher<Command> getPublisherSay() { 00044 return this.iaNode.publisherSay; 00045 } 00046 00047 public RsContext getUtils() { 00048 return this.rsutils; 00049 } 00050 00051 public static RosRiveScript getRosRiveScript(RiveScript rs) { 00052 RosRiveScript result = null; 00053 00054 if (rs.getClass() == RosRiveScript.class) { 00055 result = (RosRiveScript) rs; 00056 } else { 00057 result = null ;new MockRosRivescript(true); 00058 } 00059 00060 return result; 00061 00062 } 00063 00064 private static class MockRosRivescript extends RosRiveScript { 00065 00066 public MockRosRivescript(boolean debug) { 00067 super(null, debug); 00068 } 00069 } 00070 00071 }