User Tools

Site Tools


public:t-622-arti-07-1:alice.java
import com.cmlabs.air.JavaAIRPlug;
import com.cmlabs.air.Message;
 
public class Alice
{
   /*----------------------------------------------
   ---------     Member variables    --------------
   ----------------------------------------------*/
   private JavaAIRPlug m_obPlug = new JavaAIRPlug( "Alice", "localhost", 10000 );
 
   /*----------------------------------------------
   -----------     Constructors      --------------
   ----------------------------------------------*/
 
   /*----------------------------------------------
   ----------     Get & Set Functions    ----------
   ----------------------------------------------*/
 
   /*----------------------------------------------
   ------------      Functions       --------------
   ----------------------------------------------*/
 
   public void runModule()
   {
      while(true)
      {
         Message obMessage = m_obPlug.waitForNewMessage( 100 );
 
         if( obMessage != null)
         {
            if( obMessage.type.equalsIgnoreCase( "Intro.AI.Communication.Greeting") )
            {
               handleHello();
            }
         }
      }
   }
 
   private void handleHello()
   {
      m_obPlug.postMessage( "WB1", "Intro.AI.Communication.Greeting.Response",
                            "Hi there", "English", "" );
   }
 
   public static void main( String[] args )
   {
      Alice obAlice = new Alice();
 
      obAlice.runModule();
   }
 
}
/var/www/cadia.ru.is/wiki/data/pages/public/t-622-arti-07-1/alice.java.txt · Last modified: 2024/04/29 13:33 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki