Custom Channel Plan version of MTDOT Box firmware

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

Fork of MTDOT-BOX-EVB-Factory-Firmware by MultiTech

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 
00025 class Label {
00026     public:
00027         Label(uint8_t col, uint8_t row, std::string value);
00028 
00029         uint8_t _col;
00030         uint8_t _row;
00031         std::string _value;
00032 };
00033 
00034 class Field {
00035     public:
00036         Field(uint8_t col, uint8_t row, uint8_t maxSize);
00037 
00038         uint8_t _col;
00039         uint8_t _row;
00040         uint8_t _maxSize;
00041 };
00042 
00043 class Image {
00044     public:
00045         Image(uint8_t col, uint8_t row, const uint8_t* bmp);
00046 
00047         uint8_t _col;
00048         uint8_t _row;
00049         const uint8_t* _bmp;
00050 };
00051 
00052 class Layout {
00053     public:
00054         Layout(DOGS102* lcd);
00055         ~Layout();
00056 
00057         virtual void display() = 0;
00058         
00059     protected:
00060         void clear();
00061         void startUpdate();
00062         void endUpdate();
00063         bool writeLabel(const Label& label);
00064         bool writeField(const Field& field, const std::string& value, bool apply = false);
00065         bool writeField(const Field& field, const char* value, size_t size, bool apply = false);
00066         bool writeImage(const Image& image, bool apply = false);
00067         void removeField(const Field& field);
00068 
00069     private:
00070         bool writeText(uint8_t col, uint8_t row, const char* value, size_t size);
00071         bool writeBmp(uint8_t col, uint8_t row, const uint8_t* bmp);
00072 
00073         DOGS102* _lcd;
00074 };
00075 
00076 #endif