xxx.fidl 定义UInt8的数组array_uInt8:
package com.xxxxx.security
interface SecurityService {
version { major 1 minor 0 }
**array array_uInt8 of UInt8**
method sec_AES_encrypt {
in {
**array_uInt8** data
UInt32 dataLen
array_uInt8 key
UInt32 keyLen
}
out {
array_uInt8 encryptData
UInt32 encryptDataLen
}
}
CommonApi生成函数,参数为array_uInt8类型,直接当作std::vector使用就行,如:
void SecurityServiceStubImpl::sec_AES_decrypt(const std::shared_ptrCommonAPI::ClientId _client, SecurityService::array_uInt8 _data, SecurityService::array_uInt8 _key, sec_AES_decryptReply_t _reply) {
…
for(unsigned int i = 0; i < keyLen; i++) {
keyloc[i] = _key[i];
}
…
_dataOut.clear();
_dataOut.insert(_dataOut.end(), encrypt, encrypt + AES_BLOCK_SIZE);
…
}
xxx.hpp文件,可以看到实际类型为std::vector< uint8_t>:
class SecurityService {
public:
virtual ~SecurityService() { }
static inline const char* getInterface();
static inline CommonAPI::Version getInterfaceVersion();
**typedef std::vector< uint8_t> array_uInt8;**
};