• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2023 Huawei Device Co., Ltd.
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 //     http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 use crate::error::ErrorCode;
15 
16 mod construct;
17 mod dump;
18 mod get_task;
19 mod notification_bar;
20 mod open_channel;
21 mod pause;
22 mod query;
23 mod query_mime_type;
24 mod remove;
25 mod resume;
26 mod search;
27 mod set_max_speed;
28 mod set_mode;
29 mod show;
30 mod start;
31 mod stop;
32 mod sub_runcount;
33 mod subscribe;
34 mod touch;
35 mod unsub_runcount;
36 mod unsubscribe;
37 
38 pub(crate) const CONTROL_MAX: usize = 500;
39 pub(crate) const GET_INFO_MAX: usize = 200;
40 pub(crate) const CONSTRUCT_MAX: usize = 100;
41 
set_code_with_index(vec: &mut [ErrorCode], index: usize, code: ErrorCode)42 pub(crate) fn set_code_with_index(vec: &mut [ErrorCode], index: usize, code: ErrorCode) {
43     if let Some(c) = vec.get_mut(index) {
44         *c = code;
45     } else {
46         error!("out index: {}", index);
47     }
48 }
49 
set_code_with_index_other<T>( vec: &mut [(ErrorCode, T)], index: usize, code: ErrorCode, )50 pub(crate) fn set_code_with_index_other<T>(
51     vec: &mut [(ErrorCode, T)],
52     index: usize,
53     code: ErrorCode,
54 ) {
55     if let Some((c, _t)) = vec.get_mut(index) {
56         *c = code;
57     } else {
58         error!("out index: {}", index);
59     }
60 }
61