⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gprsclient.h

📁 一个symbian操作系统的
💻 H
字号:
/* Copyright (c) 2002, Nokia Mobile Phones. All rights reserved */

#ifndef __GPRSCLIENT_H__
#define __GPRSCLIENT_H__

#include <e32base.h>
#include <es_sock.h>
#include <in_sock.h>
#include <e32des16.h>
#include <e32des8.h>

#include "GprsClient.h"

class MDbObserver
{
public:
	virtual void ResponseReceived(TDesC8 &aResponse) = 0;
};


class CGprsClient : public CActive
{
public:

    static CGprsClient* NewL(MDbObserver *aCallb);
    static CGprsClient* NewLC(MDbObserver *aCallb);
    ~CGprsClient();
    TBool IsConnected();
    TBool IsBusy();

	//start the sequence of sending a prepared http packet to the server
	void SendL(TInetAddr &iIpAddress, const TDesC8& aDesc);

public:
	void SetSocket(RSocket* aSocket);
	void StartGprsSession();

protected:    // from CActive
    void DoCancel();

	//from CActive, called whenever an event or error occurs
    void RunL();

private:
	//actually send the packet
    void DoSendL();

	//start receiving a packet from the server
	void DoReceiveL();

	//apend received packet to buffer
	void AppendToReceiveBuffer();

	//finish the connection to the server
	void FinishConnectionL();

	CGprsClient(MDbObserver *aCallb);
    void ConstructL();

	//show a messagebox to the user
    void MessageBox(const TDesC& aMessage);

private:

    enum TState 
    {
        ENotConnected,
		EGettingConnection,
        ESending,
        EReceiving
        //EDisconnecting
    };
    
    TState iState;
    RSocketServ iSocketServer;
    RSocket *iSocket;
	MDbObserver *iCallb;
//	TBuf<20> iAddrString;
	TBuf8<10000> iData;
	TBuf8<1024> iRecvBuffer;
	TSockXfrLength iLen;
    };

#endif // __GPRSCLIENT_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -