- Fix the prevent problems.
[platform/core/connectivity/smartcard-service.git] / common / include / Message.h
1 /*
2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
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
18 #ifndef MESSAGE_H_
19 #define MESSAGE_H_
20
21 /* standard library header */
22
23 /* SLP library header */
24
25 /* local header */
26 #include "Serializable.h"
27
28 namespace smartcard_service_api
29 {
30         class Message: public Serializable
31         {
32         private:
33                 char text[200];
34
35         public:
36                 static const int MSG_REQUEST_READERS = 0x80;
37                 static const int MSG_REQUEST_SHUTDOWN = 0x81;
38                 static const int MSG_REQUEST_OPEN_SESSION = 0x82;
39                 static const int MSG_REQUEST_CLOSE_SESSION = 0x83;
40                 static const int MSG_REQUEST_OPEN_CHANNEL = 0x84;
41                 static const int MSG_REQUEST_CLOSE_CHANNEL = 0x85;
42                 static const int MSG_REQUEST_GET_ATR = 0x86;
43                 static const int MSG_REQUEST_TRANSMIT = 0x87;
44                 static const int MSG_REQUEST_GET_CHANNEL_COUNT = 0x88;
45
46                 static const int MSG_NOTIFY_SE_REMOVED = 0x90;
47                 static const int MSG_NOTIFY_SE_INSERTED = 0x91;
48
49                 static const int MSG_OPERATION_RELEASE_CLIENT = 0xC0;
50
51                 unsigned int message;
52                 unsigned int param1;
53                 unsigned int param2;
54                 ByteArray data;
55                 int error;
56                 void *caller;
57                 void *callback;
58                 void *userParam;
59
60                 Message();
61                 ~Message();
62
63                 ByteArray serialize();
64                 void deserialize(unsigned char *buffer, unsigned int length);
65                 void deserialize(ByteArray buffer);
66
67                 inline bool isSynchronousCall() { return (caller == callback); }
68
69                 const char *toString();
70         };
71
72 } /* namespace smartcard_service_api */
73 #endif /* MESSAGE_H_ */