Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

mobile.bearer.http
Class TalkingWithProxy  view TalkingWithProxy download TalkingWithProxy.java

java.lang.Object
  extended bymobile.bearer.http.TalkingWithProxy

public class TalkingWithProxy
extends java.lang.Object

The lowest level of communication, Makes connection with proxy using HTTP protocol.


Field Summary
static java.lang.String ACTIONFIELD
           
static java.lang.String CODEFIELD
           
static java.lang.String IDFIELD
           
static java.lang.String LENGTHFIELD
           
private  int messagesPerPack
           How many messages should be sent before asking if they arrived.
private  int messagesSent
           How many messages where sent since last succesful acknowledge.
private  java.lang.String mobile
           Mobile unique identifier.
static java.lang.String MOBILEFIELD
           
private  java.io.InputStream myInputStream
           Informations from proxy should appear on this stream.
static java.lang.String OWNERFIELD
           
private  java.lang.String proxyUrl
           My proxy's URL.
 
Constructor Summary
TalkingWithProxy(java.lang.String proxyUrl, int msgPerPack)
           Constructor.
 
Method Summary
 boolean connectionExists()
           Check whether mobile has connection with server.
 int[] getAcknowledge(int owner)
           Ask server if there are any messages that I (mobile) had send and was properly delivered to proxy.
 mobile.protocol.Reply getNext(int owner)
           Ask proxy if there are any messages and receive one if so.
private  void log(java.lang.String msg)
          adds the message to the console output logs - for debugging
 void openConnection()
           Opens connection with its proxy.
private  void putAcknowledge(int[] arr, int owner)
           Sends to proxy numbers of messages that was properly received.
 void putNext(int code, int owner, int id, byte[] msg)
           Sends given message.
 void setUrl(java.lang.String _url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MOBILEFIELD

public static final java.lang.String MOBILEFIELD
See Also:
Constant Field Values

OWNERFIELD

public static final java.lang.String OWNERFIELD
See Also:
Constant Field Values

CODEFIELD

public static final java.lang.String CODEFIELD
See Also:
Constant Field Values

IDFIELD

public static final java.lang.String IDFIELD
See Also:
Constant Field Values

LENGTHFIELD

public static final java.lang.String LENGTHFIELD
See Also:
Constant Field Values

ACTIONFIELD

public static final java.lang.String ACTIONFIELD
See Also:
Constant Field Values

messagesSent

private int messagesSent

How many messages where sent since last succesful acknowledge.


messagesPerPack

private int messagesPerPack

How many messages should be sent before asking if they arrived.


proxyUrl

private java.lang.String proxyUrl

My proxy's URL.


myInputStream

private java.io.InputStream myInputStream

Informations from proxy should appear on this stream.


mobile

private java.lang.String mobile

Mobile unique identifier. Imei if found, else random number.

Constructor Detail

TalkingWithProxy

public TalkingWithProxy(java.lang.String proxyUrl,
                        int msgPerPack)

Constructor.

Method Detail

log

private void log(java.lang.String msg)
adds the message to the console output logs - for debugging


openConnection

public void openConnection()

Opens connection with its proxy.


putNext

public void putNext(int code,
                    int owner,
                    int id,
                    byte[] msg)
             throws NoConnectionException,
                    NoDataException

Sends given message.


getNext

public mobile.protocol.Reply getNext(int owner)
                              throws NoConnectionException,
                                     NoDataException

Ask proxy if there are any messages and receive one if so.


putAcknowledge

private void putAcknowledge(int[] arr,
                            int owner)
                     throws NoDataException,
                            NoConnectionException

Sends to proxy numbers of messages that was properly received.


getAcknowledge

public int[] getAcknowledge(int owner)
                     throws NoConnectionException,
                            NoDataException

Ask server if there are any messages that I (mobile) had send and was properly delivered to proxy.


connectionExists

public boolean connectionExists()

Check whether mobile has connection with server. This method gives information about potential state of connection. Answering true doesn't mean that something rather might than might not be sent/received. Answering false says that the chance is near zero.


setUrl

public void setUrl(java.lang.String _url)