Java Doc for Messenger.java in  » 6.0-JDK-Modules » j2me » com » sun » midp » jsr82emul » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » com.sun.midp.jsr82emul 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.midp.jsr82emul.Messenger

Messenger
final public class Messenger (Code)
Represents JSR 82 emulation protocol, namely messages and codes recognized by emulation client and/or server. It is not a part of JSR 82 implementation and is only used within JSR 82 emulation mode. The emulation mode allows running tets without real native Bluetooth libraries or hardware. Emulation server and client communicate thru a socket by means of sending data packets of the following format:
1 byte 1 byte as defined by the previous field
packet type code length of information in bytes information bytes


Field Summary
final public static  byteCONNECT_TO_SERVICE
     Request for service connection.
final public static  byteDONE
     Notification that client does not require server any more.
final public static  StringENCODING
     Keeps encoding for messages.
final public static  byteERROR
     Responce code that identifies a failure.
final public static  byteINQUIRY_COMPLETED
     Respond on inquiry completion.
final public static  byteREGISTERED
     Successfull registration response.
final public static  byteREGISTER_DEVICE
     Device registration request code.
final public static  byteREGISTER_SERVICE
     Code for starting advertising service in the ether.
final public static  byteSERVICE_AT
     Respond that provides service connection details.
final public static  byteSPECIFIC_MESSAGE
     Code for specific messages that are only recognized by specific handlers at server side.
final public static  byteSTART_INQUIRY
     Request for inquiry start.
final public static  byteUNREGISTER_SERVICE
     Code for unregistering service.
final public static  byteUPDATE_DEVICE_STATE
     Command to update device state that includes discoverable mode and device class.

Constructor Summary
public  Messenger()
     Constructs an instance.

Method Summary
public  byte[]getBytes()
     Provides bytes read by the last receive() invocation.
public  bytegetCode()
     Provides code read by the last receive() invocation.
public  intgetInt()
     Retrieves integer represented by bytes read by the last receive() invocation.
public  StringgetMessage()
     Provides message read by the last receive() invocation.
public  voidreceive(InputStream in)
     Receives a packet from input stream given saving retrieved data in code and message.
public  voidsend(OutputStream out, byte code, String message)
     Forms a packet with given code and message and sends it to given output stream.
public  voidsendBytes(OutputStream out, byte code, byte[] info)
     Forms a packet with given code and bytes to send and sends it to given output stream.
public  voidsendInt(OutputStream out, byte code, int value)
     Forms a packet with given code and bytes that represent given integer, then sends it to given output stream.

Field Detail
CONNECT_TO_SERVICE
final public static byte CONNECT_TO_SERVICE(Code)
Request for service connection.



DONE
final public static byte DONE(Code)
Notification that client does not require server any more.



ENCODING
final public static String ENCODING(Code)
Keeps encoding for messages.



ERROR
final public static byte ERROR(Code)
Responce code that identifies a failure.



INQUIRY_COMPLETED
final public static byte INQUIRY_COMPLETED(Code)
Respond on inquiry completion.



REGISTERED
final public static byte REGISTERED(Code)
Successfull registration response.



REGISTER_DEVICE
final public static byte REGISTER_DEVICE(Code)
Device registration request code.



REGISTER_SERVICE
final public static byte REGISTER_SERVICE(Code)
Code for starting advertising service in the ether.



SERVICE_AT
final public static byte SERVICE_AT(Code)
Respond that provides service connection details.



SPECIFIC_MESSAGE
final public static byte SPECIFIC_MESSAGE(Code)
Code for specific messages that are only recognized by specific handlers at server side.



START_INQUIRY
final public static byte START_INQUIRY(Code)
Request for inquiry start.



UNREGISTER_SERVICE
final public static byte UNREGISTER_SERVICE(Code)
Code for unregistering service.



UPDATE_DEVICE_STATE
final public static byte UPDATE_DEVICE_STATE(Code)
Command to update device state that includes discoverable mode and device class.




Constructor Detail
Messenger
public Messenger()(Code)
Constructs an instance. Always use different instances for different clients/servers to make sure data stored in message and code is appropriate.




Method Detail
getBytes
public byte[] getBytes()(Code)
Provides bytes read by the last receive() invocation. bytes received last time.



getCode
public byte getCode()(Code)
Provides code read by the last receive() invocation. the code received last time, -1 if there is no valid value.



getInt
public int getInt()(Code)
Retrieves integer represented by bytes read by the last receive() invocation. Throws IllegalArgument exception if those bytes do not represent an integer. integer represented by bytes received last time.
exception:
  EmulationException - if no valid value read



getMessage
public String getMessage()(Code)
Provides message read by the last receive() invocation. string message received last time.
exception:
  EmulationException - if no valid value read



receive
public void receive(InputStream in) throws IOException(Code)
Receives a packet from input stream given saving retrieved data in code and message.
Parameters:
  in - the input stream to read from.
exception:
  IOException - if one is issued by in methods.



send
public void send(OutputStream out, byte code, String message) throws IOException(Code)
Forms a packet with given code and message and sends it to given output stream.
Parameters:
  out - the output stream to send to.
Parameters:
  code - the code to send.
Parameters:
  message - the message to send.
exception:
  IOException - if one is issued by out methods.



sendBytes
public void sendBytes(OutputStream out, byte code, byte[] info) throws IOException(Code)
Forms a packet with given code and bytes to send and sends it to given output stream.
Parameters:
  out - the output stream to send to
Parameters:
  code - the code to send
Parameters:
  info - byte array to be sent entirely
exception:
  IOException - if one is issued by out methods.



sendInt
public void sendInt(OutputStream out, byte code, int value) throws IOException(Code)
Forms a packet with given code and bytes that represent given integer, then sends it to given output stream.
Parameters:
  out - the output stream to send to
Parameters:
  code - the code to send
Parameters:
  value - integer to send
exception:
  IOException - if one is issued by out methods.



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.