2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef WRTPLUGINS_API_NFC_EVENT_TAGMIFARECLASSIC_ACTION_H_
19 #define WRTPLUGINS_API_NFC_EVENT_TAGMIFARECLASSIC_ACTION_H_
23 #include <dpl/shared_ptr.h>
29 template <class templateClass>
30 class EventTagMifareClassicAuthenticate : public EventNFCTemplate<templateClass>
33 std::vector<unsigned char> key;
35 void setKey(const std::vector<unsigned char> &keyValue) {key = keyValue;}
36 void setSectorIndex(const int index) {sectorIndex = index;}
38 std::vector<unsigned char> getKey() const {return key;}
39 int getSectorIndex() const {return sectorIndex;}
40 EventTagMifareClassicAuthenticate() { }
43 class EventTagMifareClassicAuthenticateWithKeyA : public EventTagMifareClassicAuthenticate<EventTagMifareClassicAuthenticateWithKeyA>
46 EventTagMifareClassicAuthenticateWithKeyA(const std::vector<unsigned char> &keyValue, const int index) {
48 setSectorIndex(index);
52 class EventTagMifareClassicAuthenticateWithKeyB : public EventTagMifareClassicAuthenticate<EventTagMifareClassicAuthenticateWithKeyB>
55 EventTagMifareClassicAuthenticateWithKeyB(const std::vector<unsigned char> &keyValue, const int index) {
57 setSectorIndex(index);
61 template <class templateBlockActionClass>
62 class EventTagMifareClassicBlockAction : public EventNFCTemplate<templateBlockActionClass>
66 void setBlockIndex(const int index) {blockIndex = index;}
68 EventTagMifareClassicBlockAction() {}
69 int getIndex() const {return blockIndex;}
72 class EventTagMifareClassicReadBlock : public EventTagMifareClassicBlockAction<EventTagMifareClassicReadBlock>
75 std::vector<unsigned char> blockData;
77 EventTagMifareClassicReadBlock(const int index) {setBlockIndex(index);}
78 void setBlockData(const std::vector<unsigned char> data) {blockData = data;}
79 std::vector<unsigned char> getBlockData() const {return blockData;}
82 class EventTagMifareClassicWriteBlock : public EventTagMifareClassicBlockAction<EventTagMifareClassicWriteBlock>
85 std::vector<unsigned char> blockData;
87 EventTagMifareClassicWriteBlock(const int index, const std::vector<unsigned char> data) : blockData(data) {setBlockIndex(index);}
88 std::vector<unsigned char> getBlockData() const {return blockData;}
91 class EventTagMifareClassicIncrementBlockValue : public EventTagMifareClassicBlockAction<EventTagMifareClassicIncrementBlockValue>
96 EventTagMifareClassicIncrementBlockValue(const int index, const int value) : blockValue(value) {setBlockIndex(index);}
97 int getValue() const {return blockValue;}
100 class EventTagMifareClassicDecrementBlockValue : public EventTagMifareClassicBlockAction<EventTagMifareClassicDecrementBlockValue>
105 EventTagMifareClassicDecrementBlockValue(const int index, const int value) : blockValue(value) {setBlockIndex(index);}
106 int getValue() const {return blockValue;}
109 class EventTagMifareClassicTransfer : public EventTagMifareClassicBlockAction<EventTagMifareClassicTransfer>
112 EventTagMifareClassicTransfer(const int index) {setBlockIndex(index);}
115 class EventTagMifareClassicRestore : public EventTagMifareClassicBlockAction<EventTagMifareClassicRestore>
118 EventTagMifareClassicRestore(const int index) {setBlockIndex(index);}
121 typedef DPL::SharedPtr<EventTagMifareClassicAuthenticateWithKeyA> EventTagMifareClassicAuthenticateWithKeyAPtr;
122 typedef DPL::SharedPtr<EventTagMifareClassicAuthenticateWithKeyB> EventTagMifareClassicAuthenticateWithKeyBPtr;
123 typedef DPL::SharedPtr<EventTagMifareClassicReadBlock> EventTagMifareClassicReadBlockPtr;
124 typedef DPL::SharedPtr<EventTagMifareClassicWriteBlock> EventTagMifareClassicWriteBlockPtr;
125 typedef DPL::SharedPtr<EventTagMifareClassicIncrementBlockValue> EventTagMifareClassicIncrementBlockValuePtr;
126 typedef DPL::SharedPtr<EventTagMifareClassicDecrementBlockValue> EventTagMifareClassicDecrementBlockValuePtr;
127 typedef DPL::SharedPtr<EventTagMifareClassicTransfer> EventTagMifareClassicTransferPtr;
128 typedef DPL::SharedPtr<EventTagMifareClassicRestore> EventTagMifareClassicRestorePtr;
134 #endif //WRTPLUGINS_API_NFC_EVENT_TAGMIFARECLASSIC_ACTION_H_