The MGC3130 is the world’s first electrical-field (E-field) based three-dimensional (3D) tracking and gesture controller

Dependencies:   BufferedArray

Dependents:   NucleoMGC3130 i2c_master

GestILibrarMessage/GestICMsg.cpp

Committer:
yangcq88517
Date:
2015-10-08
Revision:
2:c7d984193741
Parent:
GestICMsg.cpp@ 0:92f17b057d6b
Child:
6:b511421e7dc8

File content as of revision 2:c7d984193741:

#include "GestICMsg.h"

GestICMsg::GestICMsg() {}

GestICMsg::GestICMsg(int size)
{
    data = new char[size];
}

GestICMsg::~GestICMsg()
{
    if (data != NULL)
        delete[] data;
}

void GestICMsg::reset()
{
    position = 0;
}

void GestICMsg::set(char value)
{
    if (position >= 255)
        return;

    data[position++] = value;
}

char GestICMsg::get(int index)
{
    return data[index];
}

char * GestICMsg::gets(int index)
{
    return &data[index];
}

int GestICMsg::getPosition()
{
    return position;
}

int GestICMsg::getMsgSize()
{
    return data[0];
}

int GestICMsg::getFlags()
{
    return data[1];
}

int GestICMsg::getSeq()
{
    return data[2];
}

int GestICMsg::getID()
{
    return data[3];
}