HidReport.h
author StephaneLenclud
Sat, 26 Sep 2015 11:45:26 +0200
changeset 39 c32f4955c166
parent 0 0f874d9e4130
permissions -rw-r--r--
More fixes to our NuGet package targets file.
StephaneLenclud@35
     1
//
StephaneLenclud@35
     2
// Copyright (C) 2014-2015 Stéphane Lenclud.
StephaneLenclud@35
     3
//
StephaneLenclud@35
     4
// This file is part of MiniDisplay.
StephaneLenclud@35
     5
//
StephaneLenclud@35
     6
// MiniDisplay is free software: you can redistribute it and/or modify
StephaneLenclud@35
     7
// it under the terms of the GNU General Public License as published by
StephaneLenclud@35
     8
// the Free Software Foundation, either version 3 of the License, or
StephaneLenclud@35
     9
// (at your option) any later version.
StephaneLenclud@35
    10
//
StephaneLenclud@35
    11
// MiniDisplay is distributed in the hope that it will be useful,
StephaneLenclud@35
    12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
StephaneLenclud@35
    13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
StephaneLenclud@35
    14
// GNU General Public License for more details.
StephaneLenclud@35
    15
//
StephaneLenclud@35
    16
// You should have received a copy of the GNU General Public License
StephaneLenclud@35
    17
// along with MiniDisplay.  If not, see <http://www.gnu.org/licenses/>.
StephaneLenclud@35
    18
//
StephaneLenclud@35
    19
StephaneLenclud@35
    20
sl@0
    21
#ifndef HID_REPORT_H
sl@0
    22
#define HID_REPORT_H
sl@0
    23
sl@0
    24
#include <string.h>
sl@0
    25
sl@0
    26
/**
sl@0
    27
Define an HID report.
sl@0
    28
Can be used as input and output.
sl@0
    29
*/
sl@0
    30
template <int S>
sl@0
    31
class HidReport
sl@0
    32
    {
sl@0
    33
public:
sl@0
    34
    HidReport(){Reset();}
sl@0
    35
    void Reset();
sl@0
    36
    inline unsigned char& operator[](int aIndex){return iBuffer[aIndex];}
sl@0
    37
    const unsigned char* Buffer() const {return iBuffer;}
sl@0
    38
    unsigned char* Buffer() {return iBuffer;}
sl@0
    39
    int Size() {return S;}
sl@0
    40
protected:
sl@0
    41
    unsigned char iBuffer[S];
sl@0
    42
    };
sl@0
    43
sl@0
    44
template <int S>
sl@0
    45
void HidReport<S>::Reset()
sl@0
    46
    {
sl@0
    47
    memset(iBuffer,0,sizeof(iBuffer));
sl@0
    48
    }
sl@0
    49
sl@0
    50
sl@0
    51
#endif