--- a/.classpath Tue Aug 25 02:08:51 2009 +0200
+++ b/.classpath Tue Aug 25 02:49:40 2009 +0200
@@ -3,7 +3,6 @@
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/smackx-debug.jar"/>
<classpathentry kind="lib" path="libs/smackx-jingle.jar"/>
- <classpathentry kind="lib" path="libs/jlibrtp-0.2.2.jar"/>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
@@ -14,5 +13,6 @@
<classpathentry kind="lib" path="libs/smackx.jar"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
+ <classpathentry kind="lib" path="libs/jlibrtp.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Binary file libs/jlibrtp-0.2.2.jar has changed
Binary file libs/jlibrtp.jar has changed
--- a/res/layout/contactdialog.xml Tue Aug 25 02:08:51 2009 +0200
+++ b/res/layout/contactdialog.xml Tue Aug 25 02:49:40 2009 +0200
@@ -5,6 +5,9 @@
<Button android:id="@+id/CDChat" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/CDChat" />
+
+ <Button android:id="@+id/CDCall" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:text="@string/CDCall" />
<Button android:id="@+id/CDAlias" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/CDAlias" />
--- a/res/values-en/strings.xml Tue Aug 25 02:08:51 2009 +0200
+++ b/res/values-en/strings.xml Tue Aug 25 02:49:40 2009 +0200
@@ -34,6 +34,7 @@
<!-- ContactDialog class -->
<string name="CDChat">Chat</string>
+ <string name="CDCall">Call</string>
<string name="CDAlias">Alias</string>
<string name="CDResend">Resend suscription</string>
<string name="CDInfos">User infos</string>
--- a/res/values-fr/strings.xml Tue Aug 25 02:08:51 2009 +0200
+++ b/res/values-fr/strings.xml Tue Aug 25 02:49:40 2009 +0200
@@ -35,6 +35,7 @@
<!-- ContactDialog class -->
<string name="CDChat">Chat</string>
<string name="CDAlias">Alias</string>
+ <string name="CDCall">Appeller</string>
<string name="CDResend">Réenvoyer la demande</string>
<string name="CDInfos">Informations utilisateur</string>
<string name="CDBlock">Bloquer l\'utilisateur</string>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/jingle/JingleService.java Tue Aug 25 02:49:40 2009 +0200
@@ -0,0 +1,179 @@
+/**
+ *
+ */
+package com.beem.project.beem.jingle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smackx.jingle.JingleManager;
+import org.jivesoftware.smackx.jingle.JingleSession;
+import org.jivesoftware.smackx.jingle.JingleSessionRequest;
+import org.jivesoftware.smackx.jingle.listeners.JingleSessionListener;
+import org.jivesoftware.smackx.jingle.listeners.JingleSessionRequestListener;
+import org.jivesoftware.smackx.jingle.media.JingleMediaManager;
+import org.jivesoftware.smackx.jingle.media.PayloadType;
+import org.jivesoftware.smackx.jingle.nat.BasicTransportManager;
+import org.jivesoftware.smackx.jingle.nat.TransportCandidate;
+
+/**
+ * @author nikita
+ *
+ */
+public class JingleService {
+ private JingleManager mJingleManager;
+ private List<JingleMediaManager> mMediaManagers;
+ private JingleSession mIn;
+ private JingleSession mOut;
+
+ public JingleService(XMPPConnection xmppConnection) {
+ BasicTransportManager bt = new BasicTransportManager();
+
+ mMediaManagers = new ArrayList<JingleMediaManager>();
+ mMediaManagers.add(new RTPMediaManager(bt));
+ }
+
+ public void initWhenConntected(XMPPConnection conn) {
+ mJingleManager = new JingleManager(conn, mMediaManagers);
+ mJingleManager.addJingleSessionRequestListener(new BeemJingleSessionRequestListener());
+ }
+
+ public void call(final String destinataire) {
+ try {
+ mOut = mJingleManager.createOutgoingJingleSession(destinataire);
+ // TODO configure out avec addMediaSession et addNegociator
+ mOut.addListener(new BeemJingleCallerSessionListener());
+ mOut.startOutgoing();
+ } catch (XMPPException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ /*
+ private void receiveData(String ip, int port) throws IOException {
+ Socket s = null;
+ try {
+ s = new Socket(ip, port);
+ System.out.println("Waiting data");
+ InputStream in = s.getInputStream();
+ int a;
+ while ((a = in.read()) != -1) {
+ System.out.println("Received " + a);
+ }
+ System.out.println("End receiving data");
+ } finally {
+ if (s != null)
+ s.close();
+ }
+ }*/
+
+ private class BeemJingleReceiverSessionListener implements JingleSessionListener {
+ @Override
+ public void sessionClosed(String reason, JingleSession jingleSession) {
+ System.out.println("Session " + jingleSession.getResponder() + "closedd because " + reason);
+ }
+
+ @Override
+ public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
+ // TODO Auto-generated method stub
+ System.out.println("Session " + jingleSession.getResponder() + " closed");
+
+ }
+
+ @Override
+ public void sessionDeclined(String reason, JingleSession jingleSession) {
+ // TODO Auto-generated method stub
+ System.out
+ .println("Session " + jingleSession.getResponder() + "declined because " + reason);
+ }
+
+ @Override
+ public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
+ TransportCandidate localCandidate, JingleSession jingleSession) {
+ System.out.println("Session established");
+ System.out.println("Je recois sur " + remoteCandidate.getIp() + ":"
+ + remoteCandidate.getPort());
+ RTPReceiver rtpReceiver = new MicroRTPReceiver(remoteCandidate.getPort());
+ }
+
+ @Override
+ public void sessionMediaReceived(JingleSession jingleSession, String participant) {
+ System.out.println("Session Media received from " + participant);
+ }
+
+ @Override
+ public void sessionRedirected(String redirection, JingleSession jingleSession) {
+ }
+ }
+
+ private class BeemJingleCallerSessionListener implements JingleSessionListener {
+ @Override
+ public void sessionClosed(final String reason, final JingleSession jingleSession) {
+ System.out.println("Session " + jingleSession.getResponder() + "closed because " + reason);
+ }
+
+ @Override
+ public void sessionClosedOnError(final XMPPException e, final JingleSession jingleSession) {
+ System.out.println("Session " + jingleSession.getResponder() + " closed on error");
+
+ }
+
+ @Override
+ public void sessionDeclined(final String reason, final JingleSession jingleSession) {
+ System.out.println("Session " + jingleSession.getResponder() + "declined because " + reason);
+ }
+
+ @Override
+ public void sessionEstablished(final PayloadType pt, final TransportCandidate remoteCandidate,
+ final TransportCandidate localCandidate, final JingleSession jingleSession) {
+ System.out.println("Session established");
+ // String name = localCandidate.getName();
+ String ip = localCandidate.getIp();
+ int port = localCandidate.getPort();
+ System.out.println("Session established waiting connection on " + ip + ":" + port);
+
+
+ RTPTransmitter transm = new MicroRTPTransmitter(ip, port);
+
+ transm.run();
+ try {
+ Thread.sleep(20000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ transm.stop();
+ System.out.println("End of transfer");
+
+ }
+
+ @Override
+ public void sessionMediaReceived(final JingleSession jingleSession, final String participant) {
+ // TODO Auto-generated method stub
+ System.out.println("Session Media received from " + participant);
+ }
+
+ @Override
+ public void sessionRedirected(final String redirection, final JingleSession jingleSession) {
+ // TODO Auto-generated method stub
+ }
+ }
+
+ private class BeemJingleSessionRequestListener implements JingleSessionRequestListener {
+ @Override
+ public void sessionRequested(JingleSessionRequest request) {
+ System.out.println("Jingle Session request from " + request.getFrom());
+ try {
+ mIn = request.accept();
+ mIn.addListener(new BeemJingleReceiverSessionListener());
+ mIn.startIncoming();
+ } catch (XMPPException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/jingle/MicroRTPReceiver.java Tue Aug 25 02:49:40 2009 +0200
@@ -0,0 +1,32 @@
+/**
+ *
+ */
+package com.beem.project.beem.jingle;
+
+import org.jlibrtp.jlibrtp.DataFrame;
+import org.jlibrtp.jlibrtp.Participant;
+
+import android.util.Log;
+
+/**
+ * @author nikita
+ *
+ */
+public class MicroRTPReceiver extends RTPReceiver {
+
+ private static final String TAG = "MicroRTPReceiver";
+
+ public MicroRTPReceiver(int rtpPort) {
+ super(rtpPort);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jlibrtp.jlibrtp.RTPAppIntf#receiveData(org.jlibrtp.jlibrtp.DataFrame, org.jlibrtp.jlibrtp.Participant)
+ */
+ @Override
+ public void receiveData(DataFrame frame, Participant participant) {
+ Log.d(TAG, "data received " + frame.toString());
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/jingle/MicroRTPTransmitter.java Tue Aug 25 02:49:40 2009 +0200
@@ -0,0 +1,39 @@
+/**
+ *
+ */
+package com.beem.project.beem.jingle;
+
+import android.media.AudioFormat;
+import android.media.AudioRecord;
+import android.media.MediaRecorder;
+
+/**
+ * @author nikita
+ *
+ */
+public class MicroRTPTransmitter extends RTPTransmitter {
+
+ public MicroRTPTransmitter(String remoteIP, int port) {
+ super(remoteIP, port);
+ }
+
+ @Override
+ void start() {
+ AudioRecord audRec = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, 8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_8BIT, AudioRecord.getMinBufferSize(8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_8BIT) );
+ byte [] audioData = new byte[1024];
+ int byteReaded = 0;
+ while (!mKillme) {
+ byteReaded = audRec.read(audioData, byteReaded, 1024);
+ System.out.println("readed " + byteReaded);
+ mRtpSession.sendData(audioData);
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (Exception e) {
+ }
+ this.mRtpSession.endSession();
+
+ }
+
+}
--- a/src/com/beem/project/beem/jingle/RTPMediaManager.java Tue Aug 25 02:08:51 2009 +0200
+++ b/src/com/beem/project/beem/jingle/RTPMediaManager.java Tue Aug 25 02:49:40 2009 +0200
@@ -17,7 +17,7 @@
public static final String MEDIA_NAME = "RTP_BIDON";
- private List<PayloadType> payloads;
+ private List<PayloadType> mPayloads;
public RTPMediaManager(JingleTransportManager transportManager) {
super(transportManager);
@@ -41,13 +41,13 @@
@Override
public List<PayloadType> getPayloads() {
// TODO Auto-generated method stub
- return payloads;
+ return mPayloads;
}
private void setupPayloads() {
- payloads = new ArrayList<PayloadType>();
- payloads.add(new PayloadType.Audio(51, "BIDON1"));
- payloads.add(new PayloadType.Audio(52, "BIDON2"));
- payloads.add(new PayloadType.Audio(53, "BIDON3"));
+ mPayloads = new ArrayList<PayloadType>();
+ mPayloads.add(new PayloadType.Audio(51, "BIDON1"));
+ mPayloads.add(new PayloadType.Audio(52, "BIDON2"));
+ mPayloads.add(new PayloadType.Audio(53, "BIDON3"));
}
}
--- a/src/com/beem/project/beem/jingle/RTPMediaSession.java Tue Aug 25 02:08:51 2009 +0200
+++ b/src/com/beem/project/beem/jingle/RTPMediaSession.java Tue Aug 25 02:49:40 2009 +0200
@@ -4,19 +4,17 @@
package com.beem.project.beem.jingle;
import org.jivesoftware.smackx.jingle.JingleSession;
-import org.jivesoftware.smackx.jingle.SmackLogger;
import org.jivesoftware.smackx.jingle.media.JingleMediaSession;
import org.jivesoftware.smackx.jingle.media.PayloadType;
import org.jivesoftware.smackx.jingle.nat.TransportCandidate;
/**
- * @author darisk
+ * @author nikita
*/
public class RTPMediaSession extends JingleMediaSession {
- private static final SmackLogger LOGGER = SmackLogger.getLogger(RTPMediaSession.class);
- private RTPTransmitter transmitter;
- private RTPReceiver receiver;
+ private RTPTransmitter mTransmitter;
+ private RTPReceiver mReceiver;
/**
* @param payloadType
@@ -26,14 +24,11 @@
* @param jingleSession
*/
public RTPMediaSession(PayloadType payloadType, TransportCandidate remote, TransportCandidate local,
- String mediaLocator, JingleSession jingleSession) {
-
+ String mediaLocator, JingleSession jingleSession) {
super(payloadType, remote, local, mediaLocator, jingleSession);
- initialize();
- LOGGER.info("Demarrage d'une session avec local: " + local + " #remote: " + remote);
- transmitter = new RTPTransmitter(remote.getIp(), getRemote().getPort());
- receiver = new RTPReceiver(getLocal().getPort());
+ mTransmitter = new MicroRTPTransmitter(remote.getIp(), getRemote().getPort());
+ mReceiver = new MicroRTPReceiver(getLocal().getPort());
}
@Override
@@ -58,15 +53,15 @@
@Override
public void stopReceive() {
- if (receiver != null) {
- receiver.stop();
+ if (mReceiver != null) {
+ mReceiver.stop();
}
}
@Override
public void stopTrasmit() {
- if (transmitter != null) {
- transmitter.stop();
+ if (mTransmitter != null) {
+ mTransmitter.stop();
}
}
}
--- a/src/com/beem/project/beem/jingle/RTPReceiver.java Tue Aug 25 02:08:51 2009 +0200
+++ b/src/com/beem/project/beem/jingle/RTPReceiver.java Tue Aug 25 02:49:40 2009 +0200
@@ -4,19 +4,17 @@
import java.net.DatagramSocket;
import java.net.ServerSocket;
-import org.jivesoftware.smackx.jingle.SmackLogger;
-import org.jlibrtp.jlibrtp.core.DataFrame;
-import org.jlibrtp.jlibrtp.core.Participant;
-import org.jlibrtp.jlibrtp.core.RTPAppIntf;
-import org.jlibrtp.jlibrtp.core.RTPSession;
+import org.jlibrtp.jlibrtp.DataFrame;
+import org.jlibrtp.jlibrtp.Participant;
+import org.jlibrtp.jlibrtp.RTPAppIntf;
+import org.jlibrtp.jlibrtp.RTPSession;
public class RTPReceiver implements Runnable, RTPAppIntf {
- RTPSession rtpSession = null;
- byte[] abData = null;
- private boolean killme = false;
+ RTPSession mRtpSession = null;
+ byte[] mAbData = null;
+ private boolean mKillme = false;
- private static final SmackLogger LOGGER = SmackLogger.getLogger(SenderMediaManager.class);
public RTPReceiver(int rtpPort) {
DatagramSocket rtpSocket = null;
@@ -27,9 +25,9 @@
System.out.println("RTPSession failed to obtain port");
return;
}
- rtpSession = new RTPSession(rtpSocket, null);
- rtpSession.naivePktReception(true);
- rtpSession.RTPSessionRegister(this, null, null);
+ mRtpSession = new RTPSession(rtpSocket, null);
+ mRtpSession.naivePktReception(true);
+ mRtpSession.RTPSessionRegister(this, null, null);
}
@Override
@@ -74,8 +72,7 @@
}
private void start() {
- LOGGER.info("Debut envoi de donnees par RTPTransmitter");
- while (!killme) {
+ while (!mKillme) {
try {
Thread.sleep(1000);
} catch (Exception e) {
@@ -86,17 +83,17 @@
Thread.sleep(200);
} catch (Exception e) {
}
- this.rtpSession.endSession();
+ this.mRtpSession.endSession();
}
public void stop() {
- this.killme = true;
+ this.mKillme = true;
}
@Override
- public void userEvent(int type, Participant[] participant) {
- // rien
-
+ public void userEvent(int arg0, Participant[] arg1) {
+ // TODO Auto-generated method stub
+
}
}
--- a/src/com/beem/project/beem/jingle/RTPTransmitter.java Tue Aug 25 02:08:51 2009 +0200
+++ b/src/com/beem/project/beem/jingle/RTPTransmitter.java Tue Aug 25 02:49:40 2009 +0200
@@ -4,17 +4,14 @@
import java.net.DatagramSocket;
import java.net.ServerSocket;
-import org.jivesoftware.smackx.jingle.SmackLogger;
-import org.jlibrtp.jlibrtp.core.DataFrame;
-import org.jlibrtp.jlibrtp.core.Participant;
-import org.jlibrtp.jlibrtp.core.RTPAppIntf;
-import org.jlibrtp.jlibrtp.core.RTPSession;
+import org.jlibrtp.jlibrtp.DataFrame;
+import org.jlibrtp.jlibrtp.Participant;
+import org.jlibrtp.jlibrtp.RTPAppIntf;
+import org.jlibrtp.jlibrtp.RTPSession;
-public class RTPTransmitter implements Runnable, RTPAppIntf {
-
- private static final SmackLogger LOGGER = SmackLogger.getLogger(SenderMediaManager.class);
- private RTPSession rtpSession = null;
- private boolean killme = false;
+public abstract class RTPTransmitter implements Runnable, RTPAppIntf {
+ protected RTPSession mRtpSession = null;
+ protected boolean mKillme = false;
public RTPTransmitter(String remoteIP, int port) {
@@ -28,10 +25,10 @@
System.out.println("RTPSession failed to obtain port");
return;
}
- rtpSession = new RTPSession(rtpSocket, null);
- rtpSession.naivePktReception(true);
- rtpSession.RTPSessionRegister(this, null, null);
- rtpSession.addParticipant(new Participant(remoteIP, rtpPort, 0));
+ mRtpSession = new RTPSession(rtpSocket, null);
+ mRtpSession.naivePktReception(true);
+ mRtpSession.RTPSessionRegister(this, null, null);
+ mRtpSession.addParticipant(new Participant(remoteIP, rtpPort, 0));
}
@Override
@@ -75,21 +72,13 @@
start();
}
- private void start() {
- LOGGER.info("Debut envoi de donnees par RTPTransmitter");
- while (!killme) {
- rtpSession.sendData(null);
- }
-
- try {
- Thread.sleep(200);
- } catch (Exception e) {
- }
- this.rtpSession.endSession();
- }
+ /**
+ * A implementer pour chaque type d'envoi specifique
+ */
+ abstract void start();
public void stop() {
- this.killme = true;
+ this.mKillme = true;
}
@Override
--- a/src/com/beem/project/beem/provider/BeemDatabaseHelper.java Tue Aug 25 02:08:51 2009 +0200
+++ b/src/com/beem/project/beem/provider/BeemDatabaseHelper.java Tue Aug 25 02:49:40 2009 +0200
@@ -7,28 +7,28 @@
public class BeemDatabaseHelper extends SQLiteOpenHelper {
- private String tag;
- private String tableName;
- private String creationQuery;
+ private String mTag;
+ private String mTableName;
+ private String mCreationQuery;
public BeemDatabaseHelper(Context context, String tag, String tableName, String creationQuery) {
super(context, Beem.DB_NAME, null, Beem.DB_VERSION);
- this.tag = tag;
- this.tableName = tableName;
- this.creationQuery = creationQuery;
+ this.mTag = tag;
+ this.mTableName = tableName;
+ this.mCreationQuery = creationQuery;
}
@Override
public void onCreate(SQLiteDatabase db) {
- db.execSQL(this.creationQuery);
+ db.execSQL(this.mCreationQuery);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
- Log.w(this.tag, "Upgrading database from version " + oldVersion + " to " + newVersion
+ Log.w(this.mTag, "Upgrading database from version " + oldVersion + " to " + newVersion
+ ", which will destroy all old data");
- db.execSQL("DROP TABLE IF EXISTS " + this.tableName + ";");
+ db.execSQL("DROP TABLE IF EXISTS " + this.mTableName + ";");
onCreate(db);
}
}
--- a/src/com/beem/project/beem/service/PrivacyListManagerAdapter.java Tue Aug 25 02:08:51 2009 +0200
+++ b/src/com/beem/project/beem/service/PrivacyListManagerAdapter.java Tue Aug 25 02:49:40 2009 +0200
@@ -27,12 +27,12 @@
private PrivacyListManager mAdaptee = null;
private List<String> mBlockedUser = new ArrayList<String>();
private XMPPConnection mConnection;
- private MyPrivacyListListener privacyPacketListener = new MyPrivacyListListener();
+ private MyPrivacyListListener mPrivacyPacketListener = new MyPrivacyListListener();
public PrivacyListManagerAdapter(XMPPConnection connection) {
mConnection = connection;
mAdaptee = PrivacyListManager.getInstanceFor(mConnection);
- mAdaptee.addListener(privacyPacketListener);
+ mAdaptee.addListener(mPrivacyPacketListener);
}
public List<String> getBlockedUsers() {
@@ -42,7 +42,7 @@
public synchronized void addBlockedUser(String jid) {
if (mAdaptee == null) {
mAdaptee = PrivacyListManager.getInstanceFor(mConnection);
- mAdaptee.addListener(privacyPacketListener);
+ mAdaptee.addListener(mPrivacyPacketListener);
}
List<PrivacyItem> pItemList = new ArrayList<PrivacyItem>();
PrivacyItem pItem = new PrivacyItem("jid", true, 1);
--- a/src/com/beem/project/beem/service/XmppFacade.java Tue Aug 25 02:08:51 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppFacade.java Tue Aug 25 02:49:40 2009 +0200
@@ -8,6 +8,7 @@
import android.os.RemoteException;
import com.beem.project.beem.BeemService;
+import com.beem.project.beem.jingle.JingleService;
import com.beem.project.beem.service.aidl.IChatManager;
import com.beem.project.beem.service.aidl.IRoster;
import com.beem.project.beem.service.aidl.IXmppConnection;
@@ -22,8 +23,9 @@
*/
public class XmppFacade extends IXmppFacade.Stub {
- private XmppConnectionAdapter mConnexion;
- private BeemService mBeemService;
+ private XmppConnectionAdapter mConnexion;
+ private BeemService mBeemService;
+ private JingleService mJingle;
/**
* Constructor for XMPPFacade.
@@ -122,4 +124,9 @@
public void blockUser(String jid) throws RemoteException {
mConnexion.getPrivacyList().addBlockedUser(jid);
}
+
+ @Override
+ public void call(String jid) throws RemoteException {
+ mJingle.call(jid);
+ }
}
--- a/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl Tue Aug 25 02:08:51 2009 +0200
+++ b/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl Tue Aug 25 02:49:40 2009 +0200
@@ -47,4 +47,11 @@
void sendPresencePacket(in PresenceAdapter presence);
void blockUser(in String jid);
+
+ /**
+ * make a jingle audio call
+ * @param jid the receiver id
+ */
+
+ void call(in String jid);
}
--- a/src/com/beem/project/beem/ui/ChangeStatus.java Tue Aug 25 02:08:51 2009 +0200
+++ b/src/com/beem/project/beem/ui/ChangeStatus.java Tue Aug 25 02:49:40 2009 +0200
@@ -41,7 +41,7 @@
private SharedPreferences mSettings;
private ArrayAdapter<String> mAdapter;
- private IXmppFacade xmppFacade = null;
+ private IXmppFacade mXmppFacade = null;
private final ServiceConnection mServConn = new BeemServiceConnection();
private final OnClickListener mOnClickOk = new MyOnClickListener();
@@ -121,12 +121,12 @@
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
- xmppFacade = IXmppFacade.Stub.asInterface(service);
+ mXmppFacade = IXmppFacade.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName name) {
- xmppFacade = null;
+ mXmppFacade = null;
}
}
@@ -146,7 +146,7 @@
stopService(new Intent(ChangeStatus.this, BeemService.class));
} else {
try {
- xmppFacade.changeStatus(status, msg.toString());
+ mXmppFacade.changeStatus(status, msg.toString());
} catch (RemoteException e) {
// TODO
// Auto-generated
--- a/src/com/beem/project/beem/ui/ContactDialog.java Tue Aug 25 02:08:51 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactDialog.java Tue Aug 25 02:49:40 2009 +0200
@@ -29,7 +29,7 @@
private final Contact mContact;
private final String mGroup;
private final Context mContext;
- private IXmppFacade xmppFacade = null;
+ private IXmppFacade mXmppFacade = null;
private final ServiceConnection mServConn = new BeemServiceConnection();
public ContactDialog(final Context context, Contact curContact, String group) {
@@ -53,6 +53,8 @@
button.setOnClickListener(new infosListener());
button = (Button) findViewById(R.id.CDBlock);
button.setOnClickListener(new blockListener());
+ button = (Button) findViewById(R.id.CDCall);
+ button.setOnClickListener(new CallListener());
mContext.bindService(new Intent(mContext, BeemService.class), mServConn, Service.BIND_AUTO_CREATE);
}
@@ -63,6 +65,22 @@
mContext.unbindService(mServConn);
}
+ class CallListener implements View.OnClickListener {
+
+ @Override
+ public void onClick(View v) {
+ try {
+ //TODO: permettre a l'user de choisir a quel ressource il veut faire le call.
+ mXmppFacade.call(mContact.getJID() + "/BEEM");
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ }
+
class aliasListener implements View.OnClickListener {
@Override
@@ -70,7 +88,7 @@
ContactDialogAliasDialog dialog = new ContactDialogAliasDialog(mContext, mContact);
dialog.setOwnerActivity(ContactDialog.this.getOwnerActivity());
- dialog.initService(xmppFacade);
+ dialog.initService(mXmppFacade);
dialog.show();
}
@@ -81,7 +99,7 @@
@Override
public void onClick(View v) {
try {
- xmppFacade.blockUser(mContact.getJID());
+ mXmppFacade.blockUser(mContact.getJID());
} catch (RemoteException e) {
e.printStackTrace();
}
@@ -112,7 +130,7 @@
a.getString(R.string.CDSure2DeleteYes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
try {
- xmppFacade.getRoster().deleteContact(mContact, mGroup);
+ mXmppFacade.getRoster().deleteContact(mContact, mGroup);
} catch (RemoteException e) {
e.printStackTrace();
}
@@ -144,7 +162,7 @@
Presence presencePacket = new Presence(Presence.Type.subscribe);
presencePacket.setTo(mContact.getJID());
try {
- xmppFacade.sendPresencePacket(new PresenceAdapter(presencePacket));
+ mXmppFacade.sendPresencePacket(new PresenceAdapter(presencePacket));
} catch (RemoteException e) {
Log.e(TAG, "resend subscription error", e);
}
@@ -157,12 +175,12 @@
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
- xmppFacade = IXmppFacade.Stub.asInterface(service);
+ mXmppFacade = IXmppFacade.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName name) {
- xmppFacade = null;
+ mXmppFacade = null;
}
}