![](/media/cache/group/7eebcc78c9728c99279acaac1d5c9078.jpg.50x50_q85.jpg)
Evrythng API Example for W5500 (WIZnet chip)
Dependencies: EvrythngApi mbed
Fork of EvrythngApiExample by
Evrythng Example for W5500.
eventqueue.h@2:91570f1e9e4f, 2014-08-26 (annotated)
- Committer:
- Bongjun
- Date:
- Tue Aug 26 03:50:45 2014 +0000
- Revision:
- 2:91570f1e9e4f
- Parent:
- 0:85d6be554642
first port project for Evrythng example with W5500Interface.; IE is ok, but in case of Chrome sometimes goes to block.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vladounet | 0:85d6be554642 | 1 | /* |
vladounet | 0:85d6be554642 | 2 | * (c) Copyright 2012 EVRYTHNG Ltd London / Zurich |
vladounet | 0:85d6be554642 | 3 | * www.evrythng.com |
vladounet | 0:85d6be554642 | 4 | * |
vladounet | 0:85d6be554642 | 5 | * --- DISCLAIMER --- |
vladounet | 0:85d6be554642 | 6 | * |
vladounet | 0:85d6be554642 | 7 | * EVRYTHNG provides this source code "as is" and without warranty of any kind, |
vladounet | 0:85d6be554642 | 8 | * and hereby disclaims all express or implied warranties, including without |
vladounet | 0:85d6be554642 | 9 | * limitation warranties of merchantability, fitness for a particular purpose, |
vladounet | 0:85d6be554642 | 10 | * performance, accuracy, reliability, and non-infringement. |
vladounet | 0:85d6be554642 | 11 | * |
vladounet | 0:85d6be554642 | 12 | * Author: Michel Yerly |
vladounet | 0:85d6be554642 | 13 | * |
vladounet | 0:85d6be554642 | 14 | */ |
vladounet | 0:85d6be554642 | 15 | #include <queue> |
vladounet | 0:85d6be554642 | 16 | #include <stdint.h> |
vladounet | 0:85d6be554642 | 17 | |
vladounet | 0:85d6be554642 | 18 | enum EventType { |
vladounet | 0:85d6be554642 | 19 | EVT_SET_PROP, |
vladounet | 0:85d6be554642 | 20 | EVT_GET_PROP |
vladounet | 0:85d6be554642 | 21 | }; |
vladounet | 0:85d6be554642 | 22 | |
vladounet | 0:85d6be554642 | 23 | struct Event { |
vladounet | 0:85d6be554642 | 24 | int64_t time; |
vladounet | 0:85d6be554642 | 25 | EventType type; |
vladounet | 0:85d6be554642 | 26 | }; |
vladounet | 0:85d6be554642 | 27 | |
vladounet | 0:85d6be554642 | 28 | class EventComparison |
vladounet | 0:85d6be554642 | 29 | { |
vladounet | 0:85d6be554642 | 30 | public: |
vladounet | 0:85d6be554642 | 31 | bool operator() (const Event& lhs, const Event&rhs) const { |
vladounet | 0:85d6be554642 | 32 | return (lhs.time>rhs.time); |
vladounet | 0:85d6be554642 | 33 | } |
vladounet | 0:85d6be554642 | 34 | }; |
vladounet | 0:85d6be554642 | 35 | |
vladounet | 0:85d6be554642 | 36 | class EventQueue |
vladounet | 0:85d6be554642 | 37 | { |
vladounet | 0:85d6be554642 | 38 | public: |
vladounet | 0:85d6be554642 | 39 | void put(int64_t time, EventType type); |
vladounet | 0:85d6be554642 | 40 | EventType waitNext(int64_t currentTime); |
vladounet | 0:85d6be554642 | 41 | bool empty(); |
vladounet | 0:85d6be554642 | 42 | int size(); |
vladounet | 0:85d6be554642 | 43 | private: |
vladounet | 0:85d6be554642 | 44 | std::priority_queue<Event, std::vector<Event>, EventComparison> queue; |
vladounet | 0:85d6be554642 | 45 | }; |