MultiTech / Mbed OS MTDOT-BOX-EVB-Factory-Firmware

Dependencies:   NCP5623B GpsParser ISL29011 libmDot-mbed5 MTS-Serial MMA845x DOGS102 MPL3115A2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Layout.h Source File

Layout.h

00001 /* Copyright (c) <2016> <MultiTech Systems>, MIT License
00002  *
00003  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
00004  * and associated documentation files (the "Software"), to deal in the Software without restriction, 
00005  * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
00006  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
00007  * furnished to do so, subject to the following conditions:
00008  *
00009  * The above copyright notice and this permission notice shall be included in all copies or 
00010  * substantial portions of the Software.
00011  *
00012  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
00013  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
00014  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
00015  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
00016  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00017  */
00018 
00019 #ifndef __LAYOUT_H__
00020 #define __LAYOUT_H__
00021 
00022 #include "DOGS102.h"
00023 #include <string>
00024 #include "ChannelPlans.h"
00025 
00026 class Label {
00027     public:
00028         Label(uint8_t col, uint8_t row, std::string value);
00029 
00030         uint8_t _col;
00031         uint8_t _row;
00032         std::string _value;
00033 };
00034 
00035 class Field {
00036     public:
00037         Field(uint8_t col, uint8_t row, uint8_t maxSize);
00038 
00039         uint8_t _col;
00040         uint8_t _row;
00041         uint8_t _maxSize;
00042 };
00043 
00044 class Image {
00045     public:
00046         Image(uint8_t col, uint8_t row, const uint8_t* bmp);
00047 
00048         uint8_t _col;
00049         uint8_t _row;
00050         const uint8_t* _bmp;
00051 };
00052 
00053 class Layout {
00054     public:
00055         Layout(DOGS102* lcd);
00056         virtual ~Layout();
00057 
00058         virtual void display() = 0;
00059         
00060     protected:
00061         void clear();
00062         void startUpdate();
00063         void endUpdate();
00064         bool writeLabel(const Label& label);
00065         bool writeField(const Field& field, const std::string& value, bool apply = false);
00066         bool writeField(const Field& field, const char* value, size_t size, bool apply = false);
00067         bool writeImage(const Image& image, bool apply = false);
00068         void removeField(const Field& field);
00069 
00070     private:
00071         bool writeText(uint8_t col, uint8_t row, const char* value, size_t size);
00072         bool writeBmp(uint8_t col, uint8_t row, const uint8_t* bmp);
00073 
00074         DOGS102* _lcd;
00075 };
00076 
00077 #endif