mbed Phone Platform

Dependencies:   ulaw mbed ConfigFile

Revision:
1:0f82c574096f
Child:
2:e37117117e79
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/IpLine.h	Sun Dec 26 15:49:07 2010 +0000
@@ -0,0 +1,48 @@
+#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 &);
+};