1/*
2 * @APPLE_LICENSE_HEADER_START@
3 *
4 * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24	File:		HIDProcessMainItem.c
25
26	Contains:	xxx put contents here xxx
27
28	Version:	xxx put version here xxx
29
30	Copyright:	� 1999 by Apple Computer, Inc., all rights reserved.
31
32	File Ownership:
33
34		DRI:				xxx put dri here xxx
35
36		Other Contact:		xxx put other contact here xxx
37
38		Technology:			xxx put technology here xxx
39
40	Writers:
41
42		(BWS)	Brent Schorsch
43
44	Change History (most recent first):
45
46	  <USB1>	  3/5/99	BWS		first checked in
47*/
48
49#include "HIDLib.h"
50
51/*
52 *------------------------------------------------------------------------------
53 *
54 * HIDProcessMainItem - Process a MainItem
55 *
56 *	 Input:
57 *			  ptDescriptor			- The Descriptor Structure
58 *			  ptPreparsedData		- The PreParsedData Structure
59 *	 Output:
60 *			  ptDescriptor			- The Descriptor Structure
61 *			  ptPreparsedData		- The PreParsedData Structure
62 *	 Returns:
63 *			  kHIDSuccess		   - Success
64 *			  kHIDNullPointerErr	  - Argument, Pointer was Null
65 *
66 *------------------------------------------------------------------------------
67*/
68OSStatus HIDProcessMainItem(HIDReportDescriptor *ptDescriptor,
69								 HIDPreparsedDataPtr ptPreparsedData)
70{
71	OSStatus iStatus = kHIDSuccess;
72
73/*
74 *	Disallow NULL Pointers
75*/
76	if ((ptDescriptor == NULL) || (ptPreparsedData == NULL))
77		return kHIDNullPointerErr;
78/*
79 *	Process by MainItem Tag
80*/
81	switch (ptDescriptor->item.tag)
82	{
83		case kHIDTagCollection:
84			iStatus = HIDProcessCollection(ptDescriptor,ptPreparsedData);
85			break;
86		case kHIDTagEndCollection:
87			iStatus = HIDProcessEndCollection(ptDescriptor,ptPreparsedData);
88			break;
89		case kHIDTagInput:
90		case kHIDTagOutput:
91		case kHIDTagFeature:
92			iStatus = HIDProcessReportItem(ptDescriptor,ptPreparsedData);
93			break;
94	}
95	return iStatus;
96}
97