hidparser.h File Reference

HID Parser header file. More...

#include "hidtypes.h"

Go to the source code of this file.

Functions

int HIDParse (HIDParser *pParser, HIDData *pData)
void ResetParser (HIDParser *pParser)
int FindObject (HIDParser *pParser, HIDData *pData)
void GetValue (const uchar *Buf, HIDData *pData)
void SetValue (const HIDData *pData, uchar *Buf)
ucharGetReportOffset (HIDParser *pParser, const uchar ReportID, const uchar ReportType)


Detailed Description

HID Parser header file.

This file is part of the MGE UPS SYSTEMS HID Parser.

Copyright (C) 1998-2003 MGE UPS SYSTEMS, Written by Luc Descotils.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Definition in file hidparser.h.


Function Documentation

int FindObject ( HIDParser pParser,
HIDData pData 
)

Get pData characteristics from pData->Path or from pData->ReportID/Offset.

Returns:
TRUE if object was found

Definition at line 342 of file hidparser.c.

References HIDParse(), HIDPath::Node, HIDData::Offset, HIDData::Path, HIDData::ReportID, ResetParser(), HIDPath::Size, and HIDData::Type.

Referenced by hid_find_object().

uchar* GetReportOffset ( HIDParser pParser,
const uchar  ReportID,
const uchar  ReportType 
)

Returns:
pointer to current offset value for the Report designated by ReportID and ReportType, or NULL if not found.

Definition at line 75 of file hidparser.c.

References MAX_REPORT, HIDParser::nReport, and HIDParser::OffsetTab.

Referenced by hid_get_report_size(), and HIDParse().

void GetValue ( const uchar Buf,
HIDData pData 
)

Extract data from a report stored in Buf. Use Value, Offset, Size and LogMax of pData.

Returns:
Response in pData->Value.
Todo:
Fix this "+8" business if there is only one report ID

Definition at line 374 of file hidparser.c.

References HIDData::LogMax, HIDData::Offset, and HIDData::Value.

Referenced by hid_extract_value().

int HIDParse ( HIDParser pParser,
HIDData pData 
)

Analyze report descriptor stored in HIDParser struct and store local and global context. Return in pData the last object found.

Precondition:
Initialize HIDParser structure with ResetParser() before beginning
Returns:
TRUE when there is another item to parse.

Definition at line 119 of file hidparser.c.

References HIDData::Attribute, HIDParser::Count, HIDParser::Data, ERROR, FormatValue(), GetReportOffset(), HIDParser::Item, ITEM_COLLECTION, ITEM_END_COLLECTION, ITEM_FEATURE, ITEM_INPUT, ITEM_LOG_MAX, ITEM_LOG_MIN, ITEM_LONG, ITEM_MASK, ITEM_OUTPUT, ITEM_PHY_MAX, ITEM_PHY_MIN, ITEM_REP_COUNT, ITEM_REP_ID, ITEM_REP_SIZE, ITEM_UNIT, ITEM_UNIT_EXP, ITEM_UPAGE, ITEM_USAGE, ItemSize, HIDData::LogMax, HIDData::LogMin, MAX_REPORT, HIDParser::nObject, HIDPath::Node, HIDData::Offset, HIDData::Path, PATH_SIZE, HIDData::PhyMax, HIDData::PhyMin, HIDParser::Pos, REPORT_DSC_SIZE, HIDParser::ReportCount, HIDParser::ReportDesc, HIDParser::ReportDescSize, HIDData::ReportID, ResetLocalState(), HIDData::Size, HIDPath::Size, SIZE_MASK, HIDData::Type, HIDData::Unit, HIDData::UnitExp, HIDNode::UPage, HIDParser::UPage, HIDNode::Usage, USAGE_TAB_SIZE, HIDParser::UsageSize, HIDParser::UsageTab, and HIDParser::Value.

Referenced by FindObject(), hid_dump_tree(), and hid_prepare_parser().

void ResetParser ( HIDParser pParser  ) 

Reset HIDParser structure for new parsing. Keep Report descriptor data

Definition at line 40 of file hidparser.c.

References HIDParser::Count, HIDParser::Data, HIDParser::nObject, HIDParser::nReport, HIDParser::OffsetTab, HIDParser::Pos, HIDParser::UsageSize, and HIDParser::UsageTab.

Referenced by FindObject(), and hid_reset_parser().

void SetValue ( const HIDData pData,
uchar Buf 
)

Set a data in a report stored in Buf. Use Value, Offset and Size of pData.

Returns:
Response in Buf.

Definition at line 401 of file hidparser.c.

References HIDData::Offset, and HIDData::Value.


Generated on Sun Mar 30 15:28:25 2008 for libhid by  doxygen 1.5.1