|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * The contents of this file constitute Original Code as defined in and ! 7: * are subject to the Apple Public Source License Version 1.1 (the ! 8: * "License"). You may not use this file except in compliance with the ! 9: * License. Please obtain a copy of the License at ! 10: * http://www.apple.com/publicsource and read it before using this file. ! 11: * ! 12: * This Original Code and all software distributed under the License are ! 13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 17: * License for the specific language governing rights and limitations ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: File: HIDPostProcessRIValue.c ! 24: ! 25: Contains: xxx put contents here xxx ! 26: ! 27: Version: xxx put version here xxx ! 28: ! 29: Copyright: � 1999 by Apple Computer, Inc., all rights reserved. ! 30: ! 31: File Ownership: ! 32: ! 33: DRI: xxx put dri here xxx ! 34: ! 35: Other Contact: xxx put other contact here xxx ! 36: ! 37: Technology: xxx put technology here xxx ! 38: ! 39: Writers: ! 40: ! 41: (BWS) Brent Schorsch ! 42: ! 43: Change History (most recent first): ! 44: ! 45: <USB1> 4/7/99 BWS first checked in ! 46: */ ! 47: ! 48: #include "HIDLib.h" ! 49: ! 50: /* ! 51: *------------------------------------------------------------------------------ ! 52: * ! 53: * HIDPostProcessRIValue - performs any post-processing necessary for data ! 54: * retrieved _from_ a report for the specified report ! 55: * item. Currently, the only post-processing done ! 56: * is reversing when appropriate ! 57: * ! 58: * Input: ! 59: * reportItem - The report item ! 60: * value - the value, from HIDGetData ! 61: * Output: ! 62: * value - The processed value ! 63: * Returns: ! 64: * kHIDSuccess - Success ! 65: * ! 66: *------------------------------------------------------------------------------ ! 67: */ ! 68: ! 69: OSStatus HIDPostProcessRIValue (HIDReportItem * reportItem, ! 70: SInt32 * value) ! 71: { ! 72: ! 73: // if isReversed, returnValue = ((min - returnValue) + max) ! 74: if (reportItem->flags & kHIDReportItemFlag_Reversed) ! 75: *value = ((reportItem->globals.logicalMinimum - (*value)) + ! 76: reportItem->globals.logicalMaximum); ! 77: ! 78: return kHIDSuccess; ! 79: } ! 80: ! 81: /* ! 82: *------------------------------------------------------------------------------ ! 83: * ! 84: * HIDPreProcessRIValue - performs any pre-processing necessary for data ! 85: * ouput _to_ a report for the specified report ! 86: * item. Currently, the only pre-processing done ! 87: * is reversing when appropriate ! 88: * ! 89: * Input: ! 90: * reportItem - The report item ! 91: * value - the value, destined for HIDPutData ! 92: * Output: ! 93: * value - The processed value ! 94: * Returns: ! 95: * kHIDSuccess - Success ! 96: * ! 97: *------------------------------------------------------------------------------ ! 98: */ ! 99: ! 100: OSStatus HIDPreProcessRIValue (HIDReportItem * reportItem, ! 101: SInt32 * value) ! 102: { ! 103: ! 104: // if isReversed, returnValue = ((min - returnValue) + max) ! 105: if (reportItem->flags & kHIDReportItemFlag_Reversed) ! 106: *value = ((reportItem->globals.logicalMinimum - (*value)) + ! 107: reportItem->globals.logicalMaximum); ! 108: ! 109: return kHIDSuccess; ! 110: } ! 111: ! 112:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.