More changes about using gdbus
[platform/core/connectivity/smartcard-service.git] / common / include / Message.h
1 /*
2  * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef MESSAGE_H_
18 #define MESSAGE_H_
19 #ifndef USE_GDBUS
20 /* standard library header */
21
22 /* SLP library header */
23
24 /* local header */
25 #include "Serializable.h"
26
27 namespace smartcard_service_api
28 {
29         class Message: public Serializable
30         {
31         private:
32                 char text[200];
33
34         public:
35                 static const int MSG_REQUEST_READERS = 0x80;
36                 static const int MSG_REQUEST_SHUTDOWN = 0x81;
37                 static const int MSG_REQUEST_OPEN_SESSION = 0x82;
38                 static const int MSG_REQUEST_CLOSE_SESSION = 0x83;
39                 static const int MSG_REQUEST_OPEN_CHANNEL = 0x84;
40                 static const int MSG_REQUEST_CLOSE_CHANNEL = 0x85;
41                 static const int MSG_REQUEST_GET_ATR = 0x86;
42                 static const int MSG_REQUEST_TRANSMIT = 0x87;
43                 static const int MSG_REQUEST_GET_CHANNEL_COUNT = 0x88;
44
45                 static const int MSG_NOTIFY_SE_REMOVED = 0x90;
46                 static const int MSG_NOTIFY_SE_INSERTED = 0x91;
47
48                 static const int MSG_OPERATION_RELEASE_CLIENT = 0xC0;
49
50                 unsigned int message;
51                 unsigned long param1;
52                 unsigned long param2;
53                 ByteArray data;
54                 long error;
55                 void *caller;
56                 void *callback;
57                 void *userParam;
58
59                 Message();
60                 ~Message();
61
62                 ByteArray serialize();
63                 void deserialize(unsigned char *buffer, unsigned int length);
64                 void deserialize(ByteArray buffer);
65
66                 inline bool isSynchronousCall() { return (caller == callback); }
67
68                 const char *toString();
69         };
70
71 } /* namespace smartcard_service_api */
72 #endif
73 #endif /* MESSAGE_H_ */