2012-09-28 04:46:37 -07:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "base/basictypes.h"
|
|
|
|
#include "BluetoothOppManager.h"
|
|
|
|
|
|
|
|
#include "BluetoothReplyRunnable.h"
|
|
|
|
#include "BluetoothService.h"
|
|
|
|
#include "BluetoothServiceUuid.h"
|
2012-10-03 02:06:40 -07:00
|
|
|
#include "BluetoothUtils.h"
|
2012-09-27 07:59:27 -07:00
|
|
|
#include "ObexBase.h"
|
2012-09-28 04:46:37 -07:00
|
|
|
|
2012-10-03 02:06:40 -07:00
|
|
|
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
2012-09-28 04:46:37 -07:00
|
|
|
#include "mozilla/RefPtr.h"
|
2012-10-25 18:25:46 -07:00
|
|
|
#include "mozilla/Services.h"
|
|
|
|
#include "mozilla/StaticPtr.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsIObserverService.h"
|
2012-09-28 05:03:36 -07:00
|
|
|
#include "nsIInputStream.h"
|
2012-09-28 04:46:37 -07:00
|
|
|
|
|
|
|
USING_BLUETOOTH_NAMESPACE
|
2012-10-25 18:25:46 -07:00
|
|
|
using namespace mozilla;
|
2012-09-28 04:46:37 -07:00
|
|
|
using namespace mozilla::ipc;
|
|
|
|
|
2012-10-25 18:25:46 -07:00
|
|
|
class BluetoothOppManagerObserver : public nsIObserver
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
|
|
|
BluetoothOppManagerObserver()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Init()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
|
|
|
if (NS_FAILED(obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false))) {
|
|
|
|
NS_WARNING("Failed to add shutdown observer!");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Shutdown()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
|
|
|
if (!obs ||
|
|
|
|
(NS_FAILED(obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID)))) {
|
|
|
|
NS_WARNING("Can't unregister observers, or already unregistered!");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
~BluetoothOppManagerObserver()
|
|
|
|
{
|
|
|
|
Shutdown();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace {
|
2012-10-12 04:14:21 -07:00
|
|
|
// Sending system message "bluetooth-opp-update-progress" every 50kb
|
|
|
|
static const uint32_t kUpdateProgressBase = 50 * 1024;
|
2012-10-25 18:25:46 -07:00
|
|
|
StaticRefPtr<BluetoothOppManager> sInstance;
|
|
|
|
StaticRefPtr<BluetoothOppManagerObserver> sOppObserver;
|
2012-09-28 05:03:36 -07:00
|
|
|
static nsCOMPtr<nsIInputStream> stream = nullptr;
|
2012-10-05 01:11:21 -07:00
|
|
|
static uint32_t sSentFileLength = 0;
|
2012-10-03 02:06:40 -07:00
|
|
|
static nsString sFileName;
|
2012-10-16 23:48:52 -07:00
|
|
|
static uint32_t sFileLength = 0;
|
2012-10-12 04:14:21 -07:00
|
|
|
static nsString sContentType;
|
2012-10-05 01:11:21 -07:00
|
|
|
static int sUpdateProgressCounter = 0;
|
2012-10-25 18:25:46 -07:00
|
|
|
static bool sInShutdown = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
BluetoothOppManagerObserver::Observe(nsISupports* aSubject,
|
|
|
|
const char* aTopic,
|
|
|
|
const PRUnichar* aData)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(sInstance);
|
|
|
|
|
|
|
|
if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
|
|
|
|
return sInstance->HandleShutdown();
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(false, "BluetoothOppManager got unexpected topic!");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2012-09-28 05:03:36 -07:00
|
|
|
|
|
|
|
class ReadFileTask : public nsRunnable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ReadFileTask(nsIDOMBlob* aBlob) : mBlob(aBlob)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHOD Run()
|
|
|
|
{
|
|
|
|
if (NS_IsMainThread()) {
|
|
|
|
NS_WARNING("Can't read file from main thread");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2012-10-05 01:11:21 -07:00
|
|
|
nsresult rv;
|
2012-09-28 05:03:36 -07:00
|
|
|
|
|
|
|
if (stream == nullptr) {
|
|
|
|
rv = mBlob->GetInternalStream(getter_AddRefs(stream));
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
NS_WARNING("Can't get internal stream of blob");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 255 is the Minimum OBEX Packet Length (See section 3.3.1.4,
|
|
|
|
* IrOBEX ver 1.2)
|
|
|
|
*/
|
|
|
|
char buf[255];
|
|
|
|
uint32_t numRead;
|
|
|
|
int offset = 0;
|
|
|
|
|
|
|
|
// function inputstream->Read() only works on non-main thread
|
|
|
|
rv = stream->Read(buf, sizeof(buf), &numRead);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
// Needs error handling here
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (numRead > 0) {
|
2012-10-05 01:11:21 -07:00
|
|
|
if (sSentFileLength + numRead >= sFileLength) {
|
2012-09-28 05:03:36 -07:00
|
|
|
sInstance->SendPutRequest((uint8_t*)buf, numRead, true);
|
|
|
|
} else {
|
|
|
|
sInstance->SendPutRequest((uint8_t*)buf, numRead, false);
|
|
|
|
}
|
|
|
|
|
2012-10-05 01:11:21 -07:00
|
|
|
sSentFileLength += numRead;
|
2012-09-28 05:03:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIDOMBlob> mBlob;
|
|
|
|
};
|
2012-09-28 04:46:37 -07:00
|
|
|
|
2012-09-27 07:59:27 -07:00
|
|
|
BluetoothOppManager::BluetoothOppManager() : mConnected(false)
|
|
|
|
, mConnectionId(1)
|
|
|
|
, mLastCommand(0)
|
2012-09-28 05:03:36 -07:00
|
|
|
, mBlob(nullptr)
|
|
|
|
, mRemoteObexVersion(0)
|
|
|
|
, mRemoteConnectionFlags(0)
|
|
|
|
, mRemoteMaxPacketLength(0)
|
2012-10-03 00:09:27 -07:00
|
|
|
, mAbortFlag(false)
|
|
|
|
, mReadFileThread(nullptr)
|
2012-10-08 22:56:17 -07:00
|
|
|
, mPacketLeftLength(0)
|
2012-10-16 23:48:52 -07:00
|
|
|
, mReceiving(false)
|
|
|
|
, mPutFinal(false)
|
2012-10-18 23:16:13 -07:00
|
|
|
, mWaitingForConfirmationFlag(false)
|
2012-09-28 04:46:37 -07:00
|
|
|
{
|
2012-10-12 04:14:21 -07:00
|
|
|
// FIXME / Bug 800249:
|
|
|
|
// mConnectedDeviceAddress is Bluetooth address of connected device,
|
|
|
|
// we will be able to get this value after bug 800249 lands. For now,
|
|
|
|
// just assign a fake value to it.
|
|
|
|
mConnectedDeviceAddress.AssignASCII("00:00:00:00:00:00");
|
2012-09-28 04:46:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
BluetoothOppManager::~BluetoothOppManager()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//static
|
|
|
|
BluetoothOppManager*
|
|
|
|
BluetoothOppManager::Get()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
|
|
|
|
if (sInstance == nullptr) {
|
|
|
|
sInstance = new BluetoothOppManager();
|
|
|
|
}
|
|
|
|
|
|
|
|
return sInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BluetoothOppManager::Connect(const nsAString& aDeviceObjectPath,
|
|
|
|
BluetoothReplyRunnable* aRunnable)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
|
|
|
|
BluetoothService* bs = BluetoothService::Get();
|
|
|
|
if (!bs) {
|
|
|
|
NS_WARNING("BluetoothService not available!");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsString serviceUuidStr =
|
|
|
|
NS_ConvertUTF8toUTF16(mozilla::dom::bluetooth::BluetoothServiceUuidStr::ObjectPush);
|
|
|
|
|
|
|
|
nsRefPtr<BluetoothReplyRunnable> runnable = aRunnable;
|
|
|
|
|
|
|
|
nsresult rv = bs->GetSocketViaService(aDeviceObjectPath,
|
|
|
|
serviceUuidStr,
|
|
|
|
BluetoothSocketType::RFCOMM,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
this,
|
|
|
|
runnable);
|
|
|
|
|
|
|
|
runnable.forget();
|
|
|
|
return NS_FAILED(rv) ? false : true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BluetoothOppManager::Disconnect()
|
|
|
|
{
|
|
|
|
CloseSocket();
|
|
|
|
}
|
|
|
|
|
2012-10-25 18:25:46 -07:00
|
|
|
nsresult
|
|
|
|
BluetoothOppManager::HandleShutdown()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
sInShutdown = true;
|
|
|
|
CloseSocket();
|
|
|
|
sInstance = nullptr;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-14 23:16:41 -07:00
|
|
|
bool
|
|
|
|
BluetoothOppManager::Listen()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
|
|
|
|
CloseSocket();
|
|
|
|
|
|
|
|
BluetoothService* bs = BluetoothService::Get();
|
|
|
|
if (!bs) {
|
|
|
|
NS_WARNING("BluetoothService not available!");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult rv = bs->ListenSocketViaService(BluetoothReservedChannels::OPUSH,
|
|
|
|
BluetoothSocketType::RFCOMM,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
this);
|
|
|
|
return NS_FAILED(rv) ? false : true;
|
|
|
|
}
|
|
|
|
|
2012-09-28 04:46:37 -07:00
|
|
|
bool
|
2012-09-28 03:59:12 -07:00
|
|
|
BluetoothOppManager::SendFile(BlobParent* aActor,
|
2012-09-28 04:46:37 -07:00
|
|
|
BluetoothReplyRunnable* aRunnable)
|
|
|
|
{
|
2012-09-28 05:03:36 -07:00
|
|
|
if (mBlob) {
|
|
|
|
// Means there's a sending process. Reply error.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process of sending a file:
|
|
|
|
* - Keep blob because OPP connection has not been established yet.
|
|
|
|
* - Create an OPP connection by SendConnectRequest()
|
|
|
|
* - After receiving the response, start to read file and send.
|
|
|
|
*/
|
|
|
|
mBlob = aActor->GetBlob();
|
|
|
|
|
|
|
|
SendConnectRequest();
|
|
|
|
|
2012-09-28 04:46:37 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BluetoothOppManager::StopSendingFile(BluetoothReplyRunnable* aRunnable)
|
|
|
|
{
|
2012-10-03 00:09:27 -07:00
|
|
|
if (!mBlob) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
mAbortFlag = true;
|
|
|
|
|
2012-09-28 04:46:37 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-10-18 23:16:13 -07:00
|
|
|
void
|
|
|
|
BluetoothOppManager::ConfirmReceivingFile(bool aConfirm,
|
|
|
|
BluetoothReplyRunnable* aRunnable)
|
|
|
|
{
|
2012-10-18 23:16:13 -07:00
|
|
|
if (!mWaitingForConfirmationFlag) {
|
|
|
|
NS_WARNING("We are not waiting for a confirmation now.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ASSERTION(mPacketLeftLength == 0,
|
|
|
|
"Should not be in the middle of receiving a PUT packet.");
|
|
|
|
|
|
|
|
mWaitingForConfirmationFlag = false;
|
|
|
|
ReplyToPut(mPutFinal, aConfirm);
|
|
|
|
|
|
|
|
if (mPutFinal || !aConfirm) {
|
|
|
|
mReceiving = false;
|
|
|
|
FileTransferComplete(mConnectedDeviceAddress, aConfirm, true, sFileName,
|
|
|
|
sSentFileLength, sContentType);
|
|
|
|
}
|
2012-10-18 23:16:13 -07:00
|
|
|
}
|
|
|
|
|
2012-09-28 04:46:37 -07:00
|
|
|
// Virtual function of class SocketConsumer
|
|
|
|
void
|
|
|
|
BluetoothOppManager::ReceiveSocketData(UnixSocketRawData* aMessage)
|
|
|
|
{
|
2012-10-08 22:56:17 -07:00
|
|
|
uint8_t opCode;
|
|
|
|
int packetLength;
|
2012-09-28 05:03:36 -07:00
|
|
|
int receivedLength = aMessage->mSize;
|
2012-09-27 07:59:27 -07:00
|
|
|
|
2012-10-08 22:56:17 -07:00
|
|
|
if (mPacketLeftLength > 0) {
|
2012-10-16 23:48:52 -07:00
|
|
|
opCode = mPutFinal ? ObexRequestCode::PutFinal : ObexRequestCode::Put;
|
2012-10-08 22:56:17 -07:00
|
|
|
packetLength = mPacketLeftLength;
|
|
|
|
} else {
|
|
|
|
opCode = aMessage->mData[0];
|
|
|
|
packetLength = (((int)aMessage->mData[1]) << 8) | aMessage->mData[2];
|
|
|
|
}
|
|
|
|
|
2012-09-27 07:59:27 -07:00
|
|
|
if (mLastCommand == ObexRequestCode::Connect) {
|
2012-10-08 22:56:17 -07:00
|
|
|
if (opCode == ObexResponseCode::Success) {
|
2012-09-27 07:59:27 -07:00
|
|
|
mConnected = true;
|
2012-09-28 05:03:36 -07:00
|
|
|
|
|
|
|
// Keep remote information
|
|
|
|
mRemoteObexVersion = aMessage->mData[3];
|
|
|
|
mRemoteConnectionFlags = aMessage->mData[4];
|
|
|
|
mRemoteMaxPacketLength =
|
|
|
|
(((int)(aMessage->mData[5]) << 8) | aMessage->mData[6]);
|
|
|
|
|
|
|
|
if (mBlob) {
|
|
|
|
/*
|
|
|
|
* Before sending content, we have to send a header including
|
|
|
|
* information such as file name, file length and content type.
|
|
|
|
*/
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIDOMFile> file = do_QueryInterface(mBlob);
|
|
|
|
if (file) {
|
2012-10-03 02:06:40 -07:00
|
|
|
rv = file->GetName(sFileName);
|
2012-09-28 05:03:36 -07:00
|
|
|
}
|
|
|
|
|
2012-10-03 02:06:40 -07:00
|
|
|
if (!file || sFileName.IsEmpty()) {
|
|
|
|
sFileName.AssignLiteral("Unknown");
|
2012-09-28 05:03:36 -07:00
|
|
|
}
|
|
|
|
|
2012-10-16 23:48:52 -07:00
|
|
|
rv = mBlob->GetType(sContentType);
|
2012-09-28 05:03:36 -07:00
|
|
|
if (NS_FAILED(rv)) {
|
2012-10-16 23:48:52 -07:00
|
|
|
NS_WARNING("Can't get content type");
|
2012-09-28 05:03:36 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-16 23:48:52 -07:00
|
|
|
uint64_t fileLength;
|
|
|
|
rv = mBlob->GetSize(&fileLength);
|
2012-10-12 04:14:21 -07:00
|
|
|
if (NS_FAILED(rv)) {
|
2012-10-16 23:48:52 -07:00
|
|
|
NS_WARNING("Can't get file size");
|
2012-10-12 04:14:21 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-16 23:48:52 -07:00
|
|
|
// Currently we keep the size of files which were sent/received via
|
|
|
|
// Bluetooth not exceed UINT32_MAX because the Length header in OBEX
|
|
|
|
// is only 4-byte long. Although it is possible to transfer a file
|
|
|
|
// larger than UINT32_MAX, it needs to parse another OBEX Header
|
|
|
|
// and I would like to leave it as a feature.
|
|
|
|
if (fileLength <= UINT32_MAX) {
|
|
|
|
NS_WARNING("The file size is too large for now");
|
|
|
|
SendDisconnectRequest();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sFileLength = fileLength;
|
|
|
|
|
2012-10-03 00:09:27 -07:00
|
|
|
if (NS_FAILED(NS_NewThread(getter_AddRefs(mReadFileThread)))) {
|
|
|
|
NS_WARNING("Can't create thread");
|
|
|
|
SendDisconnectRequest();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-05 01:11:21 -07:00
|
|
|
sUpdateProgressCounter = 1;
|
|
|
|
sSentFileLength = 0;
|
2012-10-03 00:09:27 -07:00
|
|
|
mAbortFlag = false;
|
2012-10-05 01:11:21 -07:00
|
|
|
sInstance->SendPutHeaderRequest(sFileName, sFileLength);
|
2012-10-12 04:14:21 -07:00
|
|
|
StartFileTransfer(mConnectedDeviceAddress, false,
|
|
|
|
sFileName, sFileLength, sContentType);
|
2012-09-28 05:03:36 -07:00
|
|
|
}
|
2012-09-27 07:59:27 -07:00
|
|
|
}
|
|
|
|
} else if (mLastCommand == ObexRequestCode::Disconnect) {
|
2012-10-08 22:56:17 -07:00
|
|
|
if (opCode != ObexResponseCode::Success) {
|
2012-09-28 05:03:36 -07:00
|
|
|
// FIXME: Needs error handling here
|
|
|
|
NS_WARNING("[OPP] Disconnect failed");
|
|
|
|
} else {
|
2012-09-27 07:59:27 -07:00
|
|
|
mConnected = false;
|
2012-10-16 23:48:52 -07:00
|
|
|
mReceiving = false;
|
2012-10-08 22:56:17 -07:00
|
|
|
mLastCommand = 0;
|
2012-09-28 05:03:36 -07:00
|
|
|
mBlob = nullptr;
|
2012-10-03 00:09:27 -07:00
|
|
|
mReadFileThread = nullptr;
|
2012-09-28 05:03:36 -07:00
|
|
|
}
|
|
|
|
} else if (mLastCommand == ObexRequestCode::Put) {
|
2012-10-08 22:56:17 -07:00
|
|
|
if (opCode != ObexResponseCode::Continue) {
|
2012-09-28 05:03:36 -07:00
|
|
|
// FIXME: Needs error handling here
|
|
|
|
NS_WARNING("[OPP] Put failed");
|
|
|
|
} else {
|
2012-10-03 00:09:27 -07:00
|
|
|
if (mAbortFlag || mReadFileThread == nullptr) {
|
|
|
|
SendAbortRequest();
|
|
|
|
} else {
|
2012-10-05 01:11:21 -07:00
|
|
|
if (kUpdateProgressBase * sUpdateProgressCounter < sSentFileLength) {
|
2012-10-12 04:14:21 -07:00
|
|
|
UpdateProgress(mConnectedDeviceAddress, false,
|
|
|
|
sSentFileLength, sFileLength);
|
2012-10-05 01:11:21 -07:00
|
|
|
++sUpdateProgressCounter;
|
|
|
|
}
|
|
|
|
|
2012-10-03 00:09:27 -07:00
|
|
|
nsRefPtr<ReadFileTask> task = new ReadFileTask(mBlob);
|
2012-09-28 05:03:36 -07:00
|
|
|
|
2012-10-03 00:09:27 -07:00
|
|
|
if (NS_FAILED(mReadFileThread->Dispatch(task, NS_DISPATCH_NORMAL))) {
|
|
|
|
NS_WARNING("Cannot dispatch ring task!");
|
|
|
|
}
|
2012-09-28 05:03:36 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (mLastCommand == ObexRequestCode::PutFinal) {
|
2012-10-08 22:56:17 -07:00
|
|
|
if (opCode != ObexResponseCode::Success) {
|
2012-09-28 05:03:36 -07:00
|
|
|
// FIXME: Needs error handling here
|
|
|
|
NS_WARNING("[OPP] PutFinal failed");
|
|
|
|
} else {
|
2012-10-12 04:14:21 -07:00
|
|
|
FileTransferComplete(mConnectedDeviceAddress, true, false, sFileName,
|
|
|
|
sSentFileLength, sContentType);
|
2012-09-28 05:03:36 -07:00
|
|
|
SendDisconnectRequest();
|
2012-09-27 07:59:27 -07:00
|
|
|
}
|
2012-10-03 00:09:27 -07:00
|
|
|
} else if (mLastCommand == ObexRequestCode::Abort) {
|
2012-10-08 22:56:17 -07:00
|
|
|
if (opCode != ObexResponseCode::Success) {
|
2012-10-03 00:09:27 -07:00
|
|
|
NS_WARNING("[OPP] Abort failed");
|
|
|
|
}
|
|
|
|
|
2012-10-12 04:14:21 -07:00
|
|
|
FileTransferComplete(mConnectedDeviceAddress, false, false, sFileName,
|
|
|
|
sSentFileLength, sContentType);
|
2012-10-03 00:09:27 -07:00
|
|
|
SendDisconnectRequest();
|
2012-10-08 22:56:17 -07:00
|
|
|
} else {
|
|
|
|
// Remote request or unknown mLastCommand
|
2012-10-16 23:48:52 -07:00
|
|
|
ObexHeaderSet pktHeaders(opCode);
|
|
|
|
|
2012-10-08 22:56:17 -07:00
|
|
|
if (opCode == ObexRequestCode::Connect) {
|
2012-10-16 23:48:52 -07:00
|
|
|
ParseHeaders(&aMessage->mData[7], receivedLength - 7, &pktHeaders);
|
2012-10-08 22:56:17 -07:00
|
|
|
ReplyToConnect();
|
|
|
|
} else if (opCode == ObexRequestCode::Disconnect) {
|
2012-10-16 23:48:52 -07:00
|
|
|
ParseHeaders(&aMessage->mData[3], receivedLength - 3, &pktHeaders);
|
2012-10-08 22:56:17 -07:00
|
|
|
ReplyToDisconnect();
|
|
|
|
} else if (opCode == ObexRequestCode::Put ||
|
|
|
|
opCode == ObexRequestCode::PutFinal) {
|
2012-10-16 23:48:52 -07:00
|
|
|
if (!mReceiving) {
|
|
|
|
MOZ_ASSERT(mPacketLeftLength == 0);
|
|
|
|
ParseHeaders(&aMessage->mData[3], receivedLength - 3, &pktHeaders);
|
|
|
|
|
|
|
|
pktHeaders.GetName(sFileName);
|
|
|
|
pktHeaders.GetContentType(sContentType);
|
|
|
|
pktHeaders.GetLength(&sFileLength);
|
|
|
|
|
|
|
|
mReceiving = true;
|
2012-10-18 23:16:13 -07:00
|
|
|
mWaitingForConfirmationFlag = true;
|
2012-10-16 23:48:52 -07:00
|
|
|
}
|
|
|
|
|
2012-10-08 22:56:17 -07:00
|
|
|
/*
|
|
|
|
* A PUT request from remote devices may be divided into multiple parts.
|
|
|
|
* In other words, one request may need to be received multiple times,
|
|
|
|
* so here we keep a variable mPacketLeftLength to indicate if current
|
|
|
|
* PUT request is done.
|
|
|
|
*/
|
2012-10-16 23:48:52 -07:00
|
|
|
mPutFinal = (opCode == ObexRequestCode::PutFinal);
|
2012-10-08 22:56:17 -07:00
|
|
|
|
|
|
|
if (mPacketLeftLength == 0) {
|
2012-10-16 23:48:52 -07:00
|
|
|
NS_ASSERTION(mPacketLeftLength >= receivedLength,
|
|
|
|
"Invalid packet length");
|
|
|
|
mPacketLeftLength = packetLength - receivedLength;
|
2012-10-08 22:56:17 -07:00
|
|
|
} else {
|
2012-10-16 23:48:52 -07:00
|
|
|
NS_ASSERTION(mPacketLeftLength >= receivedLength,
|
2012-10-08 22:56:17 -07:00
|
|
|
"Invalid packet length");
|
2012-10-16 23:48:52 -07:00
|
|
|
mPacketLeftLength -= receivedLength;
|
|
|
|
}
|
2012-10-08 22:56:17 -07:00
|
|
|
|
2012-10-16 23:48:52 -07:00
|
|
|
if (mPacketLeftLength == 0) {
|
2012-10-18 23:16:13 -07:00
|
|
|
if (mWaitingForConfirmationFlag) {
|
|
|
|
ReceivingFileConfirmation(mConnectedDeviceAddress, sFileName,
|
|
|
|
sFileLength, sContentType);
|
|
|
|
} else {
|
|
|
|
ReplyToPut(mPutFinal, true);
|
|
|
|
|
|
|
|
if (mPutFinal) {
|
|
|
|
mReceiving = false;
|
|
|
|
FileTransferComplete(mConnectedDeviceAddress, true, true, sFileName,
|
|
|
|
sSentFileLength, sContentType);
|
|
|
|
}
|
2012-10-08 22:56:17 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-09-27 07:59:27 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-09-28 05:03:36 -07:00
|
|
|
BluetoothOppManager::SendConnectRequest()
|
2012-09-27 07:59:27 -07:00
|
|
|
{
|
2012-09-28 05:03:36 -07:00
|
|
|
if (mConnected) return;
|
|
|
|
|
2012-09-27 07:59:27 -07:00
|
|
|
// Section 3.3.1 "Connect", IrOBEX 1.2
|
2012-10-08 22:56:17 -07:00
|
|
|
// [opcode:1][length:2][version:1][flags:1][MaxPktSizeWeCanReceive:2]
|
|
|
|
// [Headers:var]
|
2012-09-27 07:59:27 -07:00
|
|
|
uint8_t req[255];
|
|
|
|
int index = 7;
|
|
|
|
|
|
|
|
req[3] = 0x10; // version=1.0
|
|
|
|
req[4] = 0x00; // flag=0x00
|
|
|
|
req[5] = BluetoothOppManager::MAX_PACKET_LENGTH >> 8;
|
|
|
|
req[6] = BluetoothOppManager::MAX_PACKET_LENGTH;
|
|
|
|
|
2012-09-28 05:03:36 -07:00
|
|
|
index += AppendHeaderConnectionId(&req[index], mConnectionId);
|
2012-09-27 07:59:27 -07:00
|
|
|
SetObexPacketInfo(req, ObexRequestCode::Connect, index);
|
|
|
|
mLastCommand = ObexRequestCode::Connect;
|
|
|
|
|
|
|
|
UnixSocketRawData* s = new UnixSocketRawData(index);
|
|
|
|
memcpy(s->mData, req, s->mSize);
|
|
|
|
SendSocketData(s);
|
2012-09-28 04:46:37 -07:00
|
|
|
}
|
|
|
|
|
2012-09-28 05:03:36 -07:00
|
|
|
void
|
2012-10-08 22:56:17 -07:00
|
|
|
BluetoothOppManager::SendPutHeaderRequest(const nsAString& aFileName,
|
|
|
|
int aFileSize)
|
2012-09-28 05:03:36 -07:00
|
|
|
{
|
|
|
|
uint8_t* req = new uint8_t[mRemoteMaxPacketLength];
|
|
|
|
|
|
|
|
const PRUnichar* fileNamePtr = aFileName.BeginReading();
|
|
|
|
uint32_t len = aFileName.Length();
|
|
|
|
uint8_t* fileName = new uint8_t[(len + 1) * 2];
|
|
|
|
for (int i = 0; i < len; i++) {
|
|
|
|
fileName[i * 2] = (uint8_t)(fileNamePtr[i] >> 8);
|
|
|
|
fileName[i * 2 + 1] = (uint8_t)fileNamePtr[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
fileName[len * 2] = 0x00;
|
|
|
|
fileName[len * 2 + 1] = 0x00;
|
|
|
|
|
|
|
|
int index = 3;
|
|
|
|
index += AppendHeaderConnectionId(&req[index], mConnectionId);
|
|
|
|
index += AppendHeaderName(&req[index], (char*)fileName, (len + 1) * 2);
|
|
|
|
index += AppendHeaderLength(&req[index], aFileSize);
|
|
|
|
|
|
|
|
SetObexPacketInfo(req, ObexRequestCode::Put, index);
|
|
|
|
mLastCommand = ObexRequestCode::Put;
|
|
|
|
|
|
|
|
UnixSocketRawData* s = new UnixSocketRawData(index);
|
|
|
|
memcpy(s->mData, req, s->mSize);
|
|
|
|
SendSocketData(s);
|
|
|
|
|
|
|
|
delete [] fileName;
|
|
|
|
delete [] req;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BluetoothOppManager::SendPutRequest(uint8_t* aFileBody,
|
|
|
|
int aFileBodyLength,
|
|
|
|
bool aFinal)
|
|
|
|
{
|
|
|
|
int sentFileBodyLength = 0;
|
|
|
|
int index = 3;
|
|
|
|
int packetLeftSpace = mRemoteMaxPacketLength - index - 3;
|
|
|
|
|
|
|
|
if (!mConnected) return;
|
|
|
|
if (aFileBodyLength > packetLeftSpace) {
|
|
|
|
NS_WARNING("Not allowed such a small MaxPacketLength value");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-08 22:56:17 -07:00
|
|
|
// Section 3.3.3 "Put", IrOBEX 1.2
|
2012-09-28 05:03:36 -07:00
|
|
|
// [opcode:1][length:2][Headers:var]
|
|
|
|
uint8_t* req = new uint8_t[mRemoteMaxPacketLength];
|
|
|
|
|
|
|
|
index += AppendHeaderBody(&req[index], aFileBody, aFileBodyLength);
|
|
|
|
|
|
|
|
if (aFinal) {
|
|
|
|
SetObexPacketInfo(req, ObexRequestCode::PutFinal, index);
|
|
|
|
mLastCommand = ObexRequestCode::PutFinal;
|
|
|
|
} else {
|
|
|
|
SetObexPacketInfo(req, ObexRequestCode::Put, index);
|
|
|
|
mLastCommand = ObexRequestCode::Put;
|
|
|
|
}
|
|
|
|
|
|
|
|
UnixSocketRawData* s = new UnixSocketRawData(index);
|
|
|
|
memcpy(s->mData, req, s->mSize);
|
|
|
|
SendSocketData(s);
|
|
|
|
|
|
|
|
delete [] req;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BluetoothOppManager::SendDisconnectRequest()
|
|
|
|
{
|
2012-10-08 22:56:17 -07:00
|
|
|
// Section 3.3.2 "Disconnect", IrOBEX 1.2
|
2012-09-28 05:03:36 -07:00
|
|
|
// [opcode:1][length:2][Headers:var]
|
|
|
|
uint8_t req[255];
|
|
|
|
int index = 3;
|
|
|
|
|
|
|
|
SetObexPacketInfo(req, ObexRequestCode::Disconnect, index);
|
|
|
|
mLastCommand = ObexRequestCode::Disconnect;
|
|
|
|
|
|
|
|
UnixSocketRawData* s = new UnixSocketRawData(index);
|
|
|
|
memcpy(s->mData, req, s->mSize);
|
|
|
|
SendSocketData(s);
|
|
|
|
}
|
2012-10-03 00:09:27 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
BluetoothOppManager::SendAbortRequest()
|
|
|
|
{
|
|
|
|
// Section 3.3.5 "Abort", IrOBEX 1.2
|
|
|
|
// [opcode:1][length:2][Headers:var]
|
|
|
|
uint8_t req[255];
|
|
|
|
int index = 3;
|
|
|
|
|
|
|
|
SetObexPacketInfo(req, ObexRequestCode::Abort, index);
|
|
|
|
mLastCommand = ObexRequestCode::Abort;
|
|
|
|
|
|
|
|
UnixSocketRawData* s = new UnixSocketRawData(index);
|
|
|
|
memcpy(s->mData, req, s->mSize);
|
|
|
|
SendSocketData(s);
|
|
|
|
}
|
2012-10-03 02:06:40 -07:00
|
|
|
|
2012-10-08 22:56:17 -07:00
|
|
|
void
|
|
|
|
BluetoothOppManager::ReplyToConnect()
|
|
|
|
{
|
|
|
|
if (mConnected) return;
|
|
|
|
mConnected = true;
|
|
|
|
|
|
|
|
// Section 3.3.1 "Connect", IrOBEX 1.2
|
|
|
|
// [opcode:1][length:2][version:1][flags:1][MaxPktSizeWeCanReceive:2]
|
|
|
|
// [Headers:var]
|
|
|
|
uint8_t req[255];
|
|
|
|
int index = 7;
|
|
|
|
|
|
|
|
req[3] = 0x10; // version=1.0
|
|
|
|
req[4] = 0x00; // flag=0x00
|
|
|
|
req[5] = BluetoothOppManager::MAX_PACKET_LENGTH >> 8;
|
|
|
|
req[6] = BluetoothOppManager::MAX_PACKET_LENGTH;
|
|
|
|
|
|
|
|
SetObexPacketInfo(req, ObexResponseCode::Success, index);
|
|
|
|
|
|
|
|
UnixSocketRawData* s = new UnixSocketRawData(index);
|
|
|
|
memcpy(s->mData, req, s->mSize);
|
|
|
|
SendSocketData(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BluetoothOppManager::ReplyToDisconnect()
|
|
|
|
{
|
|
|
|
if (!mConnected) return;
|
|
|
|
mConnected = false;
|
|
|
|
|
|
|
|
// Section 3.3.2 "Disconnect", IrOBEX 1.2
|
|
|
|
// [opcode:1][length:2][Headers:var]
|
|
|
|
uint8_t req[255];
|
|
|
|
int index = 3;
|
|
|
|
|
|
|
|
SetObexPacketInfo(req, ObexResponseCode::Success, index);
|
|
|
|
|
|
|
|
UnixSocketRawData* s = new UnixSocketRawData(index);
|
|
|
|
memcpy(s->mData, req, s->mSize);
|
|
|
|
SendSocketData(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-18 23:16:13 -07:00
|
|
|
BluetoothOppManager::ReplyToPut(bool aFinal, bool aContinue)
|
2012-10-08 22:56:17 -07:00
|
|
|
{
|
|
|
|
if (!mConnected) return;
|
|
|
|
|
|
|
|
// Section 3.3.2 "Disconnect", IrOBEX 1.2
|
|
|
|
// [opcode:1][length:2][Headers:var]
|
|
|
|
uint8_t req[255];
|
|
|
|
int index = 3;
|
|
|
|
|
2012-10-18 23:16:13 -07:00
|
|
|
if (aContinue) {
|
|
|
|
if (aFinal) {
|
|
|
|
SetObexPacketInfo(req, ObexResponseCode::Success, index);
|
|
|
|
} else {
|
|
|
|
SetObexPacketInfo(req, ObexResponseCode::Continue, index);
|
|
|
|
}
|
2012-10-08 22:56:17 -07:00
|
|
|
} else {
|
2012-10-18 23:16:13 -07:00
|
|
|
if (aFinal) {
|
|
|
|
SetObexPacketInfo(req, ObexResponseCode::Unauthorized, index);
|
|
|
|
} else {
|
|
|
|
SetObexPacketInfo(req, ObexResponseCode::Unauthorized & (~FINAL_BIT), index);
|
|
|
|
}
|
2012-10-08 22:56:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
UnixSocketRawData* s = new UnixSocketRawData(index);
|
|
|
|
memcpy(s->mData, req, s->mSize);
|
|
|
|
SendSocketData(s);
|
|
|
|
}
|
|
|
|
|
2012-10-03 02:06:40 -07:00
|
|
|
void
|
2012-10-12 04:14:21 -07:00
|
|
|
BluetoothOppManager::FileTransferComplete(const nsString& aDeviceAddress,
|
|
|
|
bool aSuccess,
|
2012-10-03 02:06:40 -07:00
|
|
|
bool aReceived,
|
|
|
|
const nsString& aFileName,
|
2012-10-12 04:14:21 -07:00
|
|
|
uint32_t aFileLength,
|
|
|
|
const nsString& aContentType)
|
2012-10-03 02:06:40 -07:00
|
|
|
{
|
|
|
|
nsString type, name;
|
|
|
|
BluetoothValue v;
|
|
|
|
InfallibleTArray<BluetoothNamedValue> parameters;
|
|
|
|
type.AssignLiteral("bluetooth-opp-transfer-complete");
|
|
|
|
|
2012-10-12 04:14:21 -07:00
|
|
|
name.AssignLiteral("address");
|
|
|
|
v = aDeviceAddress;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
2012-10-03 02:06:40 -07:00
|
|
|
name.AssignLiteral("success");
|
|
|
|
v = aSuccess;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
name.AssignLiteral("received");
|
|
|
|
v = aReceived;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
2012-10-12 04:14:21 -07:00
|
|
|
name.AssignLiteral("fileName");
|
2012-10-03 02:06:40 -07:00
|
|
|
v = aFileName;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
2012-10-12 04:14:21 -07:00
|
|
|
name.AssignLiteral("fileLength");
|
2012-10-03 02:06:40 -07:00
|
|
|
v = aFileLength;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
2012-10-12 04:14:21 -07:00
|
|
|
name.AssignLiteral("contentType");
|
|
|
|
v = aContentType;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
2012-10-03 02:06:40 -07:00
|
|
|
if (!BroadcastSystemMessage(type, parameters)) {
|
|
|
|
NS_WARNING("Failed to broadcast [bluetooth-opp-transfer-complete]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2012-10-05 01:11:21 -07:00
|
|
|
|
|
|
|
void
|
2012-10-12 04:14:21 -07:00
|
|
|
BluetoothOppManager::StartFileTransfer(const nsString& aDeviceAddress,
|
|
|
|
bool aReceived,
|
|
|
|
const nsString& aFileName,
|
|
|
|
uint32_t aFileLength,
|
|
|
|
const nsString& aContentType)
|
|
|
|
{
|
|
|
|
nsString type, name;
|
|
|
|
BluetoothValue v;
|
|
|
|
InfallibleTArray<BluetoothNamedValue> parameters;
|
|
|
|
type.AssignLiteral("bluetooth-opp-transfer-start");
|
|
|
|
|
|
|
|
name.AssignLiteral("address");
|
|
|
|
v = aDeviceAddress;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
name.AssignLiteral("received");
|
|
|
|
v = aReceived;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
name.AssignLiteral("fileName");
|
|
|
|
v = aFileName;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
name.AssignLiteral("fileLength");
|
|
|
|
v = aFileLength;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
name.AssignLiteral("contentType");
|
|
|
|
v = aContentType;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
if (!BroadcastSystemMessage(type, parameters)) {
|
|
|
|
NS_WARNING("Failed to broadcast [bluetooth-opp-transfer-start]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BluetoothOppManager::UpdateProgress(const nsString& aDeviceAddress,
|
|
|
|
bool aReceived,
|
|
|
|
uint32_t aProcessedLength,
|
|
|
|
uint32_t aFileLength)
|
2012-10-05 01:11:21 -07:00
|
|
|
{
|
|
|
|
nsString type, name;
|
|
|
|
BluetoothValue v;
|
|
|
|
InfallibleTArray<BluetoothNamedValue> parameters;
|
|
|
|
type.AssignLiteral("bluetooth-opp-update-progress");
|
|
|
|
|
2012-10-12 04:14:21 -07:00
|
|
|
name.AssignLiteral("address");
|
|
|
|
v = aDeviceAddress;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
name.AssignLiteral("received");
|
|
|
|
v = aReceived;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
name.AssignLiteral("processedLength");
|
|
|
|
v = aProcessedLength;
|
2012-10-05 01:11:21 -07:00
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
2012-10-12 04:14:21 -07:00
|
|
|
name.AssignLiteral("fileLength");
|
2012-10-05 01:11:21 -07:00
|
|
|
v = aFileLength;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
if (!BroadcastSystemMessage(type, parameters)) {
|
|
|
|
NS_WARNING("Failed to broadcast [bluetooth-opp-update-progress]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2012-10-10 22:49:11 -07:00
|
|
|
|
2012-10-16 23:46:53 -07:00
|
|
|
void
|
|
|
|
BluetoothOppManager::ReceivingFileConfirmation(const nsString& aAddress,
|
|
|
|
const nsString& aFileName,
|
|
|
|
uint32_t aFileLength,
|
|
|
|
const nsString& aContentType)
|
|
|
|
{
|
|
|
|
nsString type, name;
|
|
|
|
BluetoothValue v;
|
|
|
|
InfallibleTArray<BluetoothNamedValue> parameters;
|
|
|
|
type.AssignLiteral("bluetooth-opp-receiving-file-confirmation");
|
|
|
|
|
|
|
|
name.AssignLiteral("address");
|
|
|
|
v = aAddress;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
name.AssignLiteral("fileName");
|
|
|
|
v = aFileName;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
name.AssignLiteral("fileLength");
|
|
|
|
v = aFileLength;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
name.AssignLiteral("contentType");
|
|
|
|
v = aContentType;
|
|
|
|
parameters.AppendElement(BluetoothNamedValue(name, v));
|
|
|
|
|
|
|
|
if (!BroadcastSystemMessage(type, parameters)) {
|
|
|
|
NS_WARNING("Failed to broadcast [bluetooth-opp-receiving-file-confirmation]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2012-10-16 23:48:52 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
BluetoothOppManager::OnConnectSuccess()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BluetoothOppManager::OnConnectError()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BluetoothOppManager::OnDisconnect()
|
|
|
|
{
|
|
|
|
}
|