Suga koubou / Mbed 2 deprecated PhonePlatform

Dependencies:   ulaw mbed ConfigFile

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers IpLine.h Source File

IpLine.h

00001 #include "phone.h"
00002 #include "mbed.h"
00003 #include "EthernetNetIf.h"
00004 #include "UDPSocket.h"
00005 #include "RingBuffer.h"
00006 #include "ulaw.h"
00007 
00008 struct ipline_header {
00009     unsigned long ident;
00010     unsigned short num;
00011     enum PhoneType target;
00012     enum Mode mode;
00013     enum Status status;
00014 };
00015 
00016 struct ipline_packet {
00017     struct ipline_header header;
00018     unsigned short len;
00019     char data[DATA_SIZE];
00020 };
00021 
00022 
00023 /**
00024  * @brief IpLine class
00025  */
00026 class IpLine {
00027 public:
00028     IpLine (EthernetNetIf *, AnalogOut, AnalogIn);
00029 
00030     void intr ();
00031     void poll ();
00032     int enter (enum Mode);
00033     int scan (enum Scan);
00034     void settarget (enum PhoneType, char *);
00035 
00036 private:
00037     volatile enum PhoneType remotetarget;
00038     volatile enum Mode mode;
00039     volatile enum Status status;
00040     volatile int hook, packet_num, dataskip, timeout, dialconut, wait, timerled;
00041     EthernetNetIf *eth;
00042     UDPSocket *udpsock;
00043     Host remote;
00044     AnalogOut dac;
00045     AnalogIn adc;
00046     RingBuffer dial, dabuf, adbuf;
00047     struct ipline_header last;
00048     DigitalOut led_y, led_g;
00049     DigitalIn eth_link, eth_speed;
00050 
00051     void onLisnerEvent (UDPSocketEvent);
00052     void send (struct ipline_header *);
00053     void send (struct ipline_packet *);
00054     unsigned long xor128 ();
00055     int gaussian ();
00056 };