1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef SANE_INFO_H 17 #define SANE_INFO_H 18 19 namespace OHOS::Scan { 20 constexpr int32_t MAX_BUFLEN = 1024 * 1024 * 1024; // 1G 21 enum SaneReadRet { 22 SANE_READ_OK = 0, 23 SANE_READ_FAIL = 1, 24 }; 25 enum SaneStatus { 26 SANE_STATUS_GOOD = 0, // everything A-OK 27 SANE_STATUS_UNSUPPORTED, // operation is not supported 28 SANE_STATUS_CANCELLED, // operation was cancelled 29 SANE_STATUS_DEVICE_BUSY, // device is busy; try again later 30 SANE_STATUS_INVAL, // data is invalid (includes no dev at open) 31 SANE_STATUS_EOF, // no more data available (end-of-file) 32 SANE_STATUS_JAMMED, // document feeder jammed 33 SANE_STATUS_NO_DOCS, // document feeder out of documents 34 SANE_STATUS_COVER_OPEN, // scanner cover is open 35 SANE_STATUS_IO_ERROR, // error during device I/O 36 SANE_STATUS_NO_MEM, // out of memory 37 SANE_STATUS_ACCESS_DENIED, // access to resource has been denied 38 SANE_STATUS_NO_PERMISSION = 201, // no permission 39 SANE_STATUS_INVALID_PARAMETER = 401, // invalid parameter 40 SANE_STATUS_GENERIC_FAILURE = 13100001, // generic failure of sane service 41 SANE_STATUS_RPC_FAILURE = 13100002, // RPC failure 42 SANE_STATUS_SERVER_FAILURE = 13100003, // failure of sane service 43 }; 44 45 enum SaneAction { 46 SANE_ACTION_GET_VALUE = 0, 47 SANE_ACTION_SET_VALUE, 48 SANE_ACTION_SET_AUTO 49 }; 50 51 enum SaneConstraintType { 52 SANE_CONSTRAINT_NONE = 0, 53 SANE_CONSTRAINT_RANGE, 54 SANE_CONSTRAINT_WORD_LIST, 55 SANE_CONSTRAINT_STRING_LIST, 56 }; 57 58 enum SaneFrame { 59 SANE_FRAME_GRAY = 0, // band covering human visual range 60 SANE_FRAME_RGB, // pixel-interleaved red/green/blue bands 61 SANE_FRAME_RED, // red band only 62 SANE_FRAME_GREEN, // green band only 63 SANE_FRAME_BLUE // blue band only 64 }; 65 } // namespace OHOS::SCAN 66 #endif // SANE_INFO_H