• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 TOUCHPAD_CONTROL_DISPLAY_GAIN
17 #define TOUCHPAD_CONTROL_DISPLAY_GAIN
18 
19 #include "parcel.h"
20 
21 namespace OHOS {
22 namespace MMI {
23 struct TouchpadCDG : public Parcelable {
24     double ppi;
25     double size;
26     int32_t speed;
27     float zOrder;
28     int32_t frequency;
29 
MarshallingTouchpadCDG30     bool Marshalling(Parcel &parcel) const
31     {
32         if (!parcel.WriteDouble(ppi)) {
33             return false;
34         }
35         if (!parcel.WriteDouble(size)) {
36             return false;
37         }
38         if (!parcel.WriteInt32(speed)) {
39             return false;
40         }
41         if (!parcel.WriteInt32(frequency)) {
42             return false;
43         }
44         return true;
45     };
46 
ReadFromParcelTouchpadCDG47     bool ReadFromParcel(Parcel &parcel)
48     {
49         return (
50             parcel.ReadDouble(ppi) &&
51             parcel.ReadDouble(size) &&
52             parcel.ReadInt32(speed) &&
53             parcel.ReadInt32(frequency)
54         );
55     }
56 
UnmarshallingTouchpadCDG57     static TouchpadCDG* Unmarshalling(Parcel &parcel)
58     {
59         auto obj = new (std::nothrow) TouchpadCDG();
60         if (obj && !obj->ReadFromParcel(parcel)) {
61             delete obj;
62             obj = nullptr;
63         }
64         return obj;
65     };
66 };
67 } // namespace MMI
68 } // namespace OHOS
69 #endif // TOUCHPAD_CONTROL_DISPLAY_GAIN