mbed Phone Platform

Dependencies:   ulaw mbed ConfigFile

IpLine.h

Committer:
okini3939
Date:
2010-12-26
Revision:
1:0f82c574096f
Child:
2:e37117117e79

File content as of revision 1:0f82c574096f:

#include "phone.h"
#include "mbed.h"
#include "EthernetNetIf.h"
#include "UDPSocket.h"
#include "RingBuffer.h"
#include "ulaw.h"

struct ipline_header {
    unsigned short num;
    enum PhoneType target;
    enum Mode mode;
    enum Status status;
};

struct ipline_packet {
    struct ipline_header header;
    unsigned short len;
    char data[DATA_SIZE];
};


class IpLine {
public:
    IpLine (AnalogOut, AnalogIn);

    void poll ();
    void netpoll ();
    int enter (enum Mode);
    int scan (enum Scan);
    void settarget (enum PhoneType, char *);

private:
    enum PhoneType remotetarget;
    enum Mode mode;
    enum Status status;
    int hook, packet_num, dataskip, timeout, dialconut;
    EthernetNetIf *eth;
    UDPSocket *udpsock;
    Host remote;
    AnalogOut dac;
    AnalogIn adc;
    RingBuffer dial, dabuf, adbuf;
    struct ipline_header last;

    void onLisnerEvent (UDPSocketEvent);
    void send (struct ipline_header &);
    void send (struct ipline_packet &);
};