APC AP9212 User's Guide Page 43

  • Download
  • Add to my manuals
  • Print
  • Page
    / 147
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 42
43
5.5 Chat system
Given the distributed nature and complexity of the APT control system it is desirable to be able to
communicate with other users currently logged in. For example, a higher priority user would be
able to ask the current user what they were working on before overriding their control.
This level of communication would also be very useful in a classroom environment. Students
would be communicate remotely with other users controlling the telescope. For example,
although the GUI can display a variety of status information, the intentions of the user in control
could be somewhat difficult to discover. The chat system could be used to simply tell the
connected users why the telescope is slewing to particular coordinates.
The APT chat system is most certainly this simplest of all the APT services, implemented as a
JASChannel designed to send and receive JASChatMessages
i
.
JASChatMessages are sent from a ChatPanel by simply utilising the sendToAll() method
provided by the JAS, as shown below.
...
JASComms.getJASComms().getChatChannel().sendToAll(
new JASChatMessage( System.getProperty("user.name")+": "+msg + "\n" )
);
...
Figure 5-6 Client sending JASChatMessages
When a JASChatComponentManager receives a JASChatMessage it conveys this information
to any registered JASChatComponents, in accordance with the BoundComponent Framework
discussed in Appendix B.3. Since the ChatPanel is a registered JASChatComponent, it receives
this message and subsequently prints it to the screen, as shown in Figure 5-8.
The sole responsibility of the server is to initialise the CHANNEL_CHAT and create the
JASChatManager.
...
// APTServer.java
// Initialise JASChatManager
JASChannel chatChannel = client.makeChannel( Channels.CHANNEL_CHAT );
chatChannel.join();
new JASChatManager( chatChannel );
...
Figure 5-7 JASChatManager usage
The JASChatManager simply creates a ChannelMonitor, as shown in Appendix B.5, which
broadcasts notification messages when users join and leave the chat. Joining and leaving the
chat is analogous to joining the leaving the chat channel.
i
Currently implemented as a String
Page view 42
1 2 ... 38 39 40 41 42 43 44 45 46 47 48 ... 146 147

Comments to this Manuals

No comments