00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "cobain.h"
00026 #include "clientsession.h"
00027 #include "clientservercommon.h"
00028
00029 CNetworkPeer* CNetworkPeer::NewL(RCobainClientSession &aSession,
00030 TProtocol aProtocol,
00031 TDesC &aDeviceName,
00032 TDesC8 &aDeviceAddress,
00033 TDesC8 &aServiceID,
00034 TUint aPort)
00035 {
00036 CNetworkPeer *c = new CNetworkPeer(aSession, aProtocol, aPort);
00037 CleanupStack::PushL(c);
00038 c->ConstructL(aDeviceName, aDeviceAddress, aServiceID);
00039 CleanupStack::Pop();
00040
00041 return c;
00042 }
00043
00044 void CNetworkPeer::ConstructL(TDesC &aDeviceName,
00045 TDesC8 &aDeviceAddress,
00046 TDesC8 &aServiceID)
00047 {
00048 iDeviceName = aDeviceName.AllocL();
00049 iDeviceAddress = aDeviceAddress.AllocL();
00050 iServiceID = aServiceID.AllocL();
00051 }
00052
00053 CNetworkPeer::CNetworkPeer(RCobainClientSession &aSession,
00054 TProtocol aProtocol,
00055 TUint aPort)
00056 : iSession(aSession),
00057 iProtocol(aProtocol),
00058 iPort(aPort)
00059 {
00060 }
00061
00062
00063
00064
00065
00066 EXPORT_C CNetworkPeer::~CNetworkPeer()
00067 {
00068 delete iDeviceName;
00069 delete iDeviceAddress;
00070 delete iServiceID;
00071 }
00072
00073 EXPORT_C RCobainSocket* CNetworkPeer::ConnectL()
00074 {
00075 return iSession.ConnectSocketL(this);
00076 }