本文整理汇总了C++中Parcel::readString16方法的典型用法代码示例。如果您正苦于以下问题:C++ Parcel::readString16方法的具体用法?C++ Parcel::readString16怎么用?C++ Parcel::readString16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parcel
的用法示例。
在下文中一共展示了Parcel::readString16方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RILCall
RILCall(const Parcel& data) {
state = static_cast<RIL_CallState>(data.readInt32());
index = data.readInt32();
toa = data.readInt32();
isMpty = (data.readInt32() != 0);
isMT = (data.readInt32() != 0);
als = data.readInt32();
isVoice = data.readInt32();
isVoicePrivacy = data.readInt32();
number = data.readString16();
numberPresentation = data.readInt32();
name = data.readString16();
namePresentation = data.readInt32();
hasUusInfo = (data.readInt32() != 0);
if (hasUusInfo) {
// ### TODO: Check this with something that has UUS
uusType = static_cast<RIL_UUS_Type>(data.readInt32());
uusDcs = static_cast<RIL_UUS_DCS>(data.readInt32());
uusLength = data.readInt32();
uusData = NULL;
if (uusLength > 0) {
uusData = new char[uusLength];
data.read(uusData, uusLength);
}
}
}
示例2: onTransact
status_t BnSensorServer::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case GET_SENSOR_LIST: {
CHECK_INTERFACE(ISensorServer, data, reply);
const String16& opPackageName = data.readString16();
Vector<Sensor> v(getSensorList(opPackageName));
size_t n = v.size();
reply->writeUint32(static_cast<uint32_t>(n));
for (size_t i = 0; i < n; i++) {
reply->write(v[i]);
}
return NO_ERROR;
}
case CREATE_SENSOR_EVENT_CONNECTION: {
CHECK_INTERFACE(ISensorServer, data, reply);
String8 packageName = data.readString8();
int32_t mode = data.readInt32();
const String16& opPackageName = data.readString16();
sp<ISensorEventConnection> connection(createSensorEventConnection(packageName, mode,
opPackageName));
reply->writeStrongBinder(IInterface::asBinder(connection));
return NO_ERROR;
}
case ENABLE_DATA_INJECTION: {
CHECK_INTERFACE(ISensorServer, data, reply);
int32_t ret = isDataInjectionEnabled();
reply->writeInt32(static_cast<int32_t>(ret));
return NO_ERROR;
}
}
return BBinder::onTransact(code, data, reply, flags);
}
示例3: onTransact
// Notes about data transaction:
// Java Binder Wrapper call readInt32 before reading return data
// It treet this in value as exception code
// OnTransact method support this feature
status_t BnOpenCVEngine::onTransact(uint32_t code, const Parcel& data, android::Parcel* reply, uint32_t flags)
{
LOGD("OpenCVEngine::OnTransact(%u,%u)", code, flags);
switch(code)
{
case OCVE_GET_ENGINE_VERSION:
{
LOGD("OpenCVEngine OCVE_GET_ENGINE_VERSION request");
CHECK_INTERFACE(IOpenCVEngine, data, reply);
LOGD("OpenCVEngine::GetVersion()");
reply->writeInt32(0);
return reply->writeInt32(GetVersion());
} break;
case OCVE_GET_LIB_PATH_BY_VERSION:
{
LOGD("OpenCVEngine OCVE_GET_LIB_PATH_BY_VERSION request");
CHECK_INTERFACE(IOpenCVEngine, data, reply);
const String16 version = data.readString16();
LOGD("OpenCVEngine::GetLibPathByVersion(%s)", String8(version).string());
String16 path = GetLibPathByVersion(version);
reply->writeInt32(0);
return reply->writeString16(path);
} break;
case OCVE_GET_LIB_LIST:
{
LOGD("OpenCVEngine OCVE_GET_LIB_LIST request");
CHECK_INTERFACE(IOpenCVEngine, data, reply);
const String16 version = data.readString16();
LOGD("OpenCVEngine::GetLibraryList(%s)", String8(version).string());
String16 path = GetLibraryList(version);
reply->writeInt32(0);
return reply->writeString16(path);
} break;
case OCVE_INSTALL_VERSION:
{
LOGD("OpenCVEngine OCVE_INSTALL_VERSION request");
CHECK_INTERFACE(IOpenCVEngine, data, reply);
const String16 version = data.readString16();
LOGD("OpenCVEngine::InstallVersion(%s)", String8(version).string());
bool result = InstallVersion(version);
reply->writeInt32(0);
int res = reply->writeInt32(static_cast<int32_t>(result));
LOGD("InstallVersion call to Binder finished with res %d", res);
return res;
} break;
default:
{
LOGD("OpenCVEngine unknown request");
return BBinder::onTransact(code, data, reply, flags);
}
}
return android::NO_ERROR;
}
示例4: onTransact
status_t BBinder::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t /*flags*/)
{
switch (code) {
case INTERFACE_TRANSACTION:
reply->writeString16(getInterfaceDescriptor());
return NO_ERROR;
case DUMP_TRANSACTION: {
int fd = data.readFileDescriptor();
int argc = data.readInt32();
Vector<String16> args;
for (int i = 0; i < argc && data.dataAvail() > 0; i++) {
args.add(data.readString16());
}
return dump(fd, args);
}
case SHELL_COMMAND_TRANSACTION: {
int in = data.readFileDescriptor();
int out = data.readFileDescriptor();
int err = data.readFileDescriptor();
int argc = data.readInt32();
Vector<String16> args;
for (int i = 0; i < argc && data.dataAvail() > 0; i++) {
args.add(data.readString16());
}
sp<IShellCallback> shellCallback = IShellCallback::asInterface(
data.readStrongBinder());
sp<IResultReceiver> resultReceiver = IResultReceiver::asInterface(
data.readStrongBinder());
// XXX can't add virtuals until binaries are updated.
//return shellCommand(in, out, err, args, resultReceiver);
(void)in;
(void)out;
(void)err;
if (resultReceiver != NULL) {
resultReceiver->send(INVALID_OPERATION);
}
return NO_ERROR;
}
case SYSPROPS_TRANSACTION: {
report_sysprop_change();
return NO_ERROR;
}
default:
return UNKNOWN_TRANSACTION;
}
}
示例5: readFromParcel
status_t Status::readFromParcel(const Parcel& parcel) {
status_t status = parcel.readInt32(&mException);
if (status != OK) {
setFromStatusT(status);
return status;
}
// Skip over fat response headers. Not used (or propagated) in native code.
if (mException == EX_HAS_REPLY_HEADER) {
// Note that the header size includes the 4 byte size field.
const int32_t header_start = parcel.dataPosition();
int32_t header_size;
status = parcel.readInt32(&header_size);
if (status != OK) {
setFromStatusT(status);
return status;
}
parcel.setDataPosition(header_start + header_size);
// And fat response headers are currently only used when there are no
// exceptions, so act like there was no error.
mException = EX_NONE;
}
if (mException == EX_NONE) {
return status;
}
// The remote threw an exception. Get the message back.
mMessage = String8(parcel.readString16());
return status;
}
示例6: onTransact
status_t BBinder::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch (code) {
case INTERFACE_TRANSACTION:
reply->writeString16(getInterfaceDescriptor());
return NO_ERROR;
case DUMP_TRANSACTION: {
int fd = data.readFileDescriptor();
int argc = data.readInt32();
Vector<String16> args;
for (int i = 0; i < argc && data.dataAvail() > 0; i++) {
args.add(data.readString16());
}
return dump(fd, args);
}
case SYSPROPS_TRANSACTION: {
report_sysprop_change();
return NO_ERROR;
}
default:
return UNKNOWN_TRANSACTION;
}
}
示例7: onTransact
status_t ArcHmbPlayerBinder::onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) {
ALOGE("ArcHmbPlayerBinder::onTransact(%i) %i", code, flags);
/*
* Before executing actual method, check whether the RPC are from expected client.
* Client will write interface token, to identify interface to which those methods
* belong.
*/
if (!data.enforceInterface(ArcHmbPlayerInterface::DESCRIPTOR)) {
ALOGE("failed to check Interface, you might call wrong service, this is for '%s'",
String8(ArcHmbPlayerInterface::DESCRIPTOR).string());
return BAD_TYPE;
}
data.print(aout);
endl(aout);
switch(code) {
case ArcHmbPlayerInterface::PRINT: {
String16 msg = data.readString16();
print(String8(msg).string());
return NO_ERROR;
}
case ArcHmbPlayerInterface::ADD: {
int32_t a = data.readInt32();
int32_t b = data.readInt32();
int32_t sum = add(a, b);
ALOGE("ArcHmbPlayerBinder:onTransact add(%i, %i) = %i", a, b, sum);
reply->print(aout); endl(aout);
reply->writeInt32(sum);
return NO_ERROR;
}
default:
ALOGE("ArcHmbPlayerBinder, bad requesting code, no match found");
}
return BBinder::onTransact(code, data, reply, flags);
}
示例8: onTransact
/* BnHelloWorld */
status_t BnHelloWorld::onTransact(uint32_t code,
const Parcel &data,
Parcel *reply,
uint32_t flags)
{
LOGE("OnTransact(%u,%u)", code, flags);
CHECK_INTERFACE(IHelloWorld, data, reply);
switch(code) {
case HW_HELLOTHERE: {
/**
* Checking permissions is always a good idea.
*
* Note that the native client will also be granted these permissions in two cases
* 1) you run the client code as root or system user.
* 2) you run the client code as user who was granted this permission.
* @see http://github.com/keesj/gomo/wiki/AndroidSecurity for more information
**/
if (checkCallingPermission(String16("org.credil.helloworldservice.permissions.CALL_HELLOTHERE")) == false){
return PERMISSION_DENIED;
}
String16 str = data.readString16();
hellothere(String8(str).string());
///reply->writeString16(str);
return NO_ERROR;
} break;
case RETURN_INT_SHANQUAN:{
if (checkCallingPermission(String16("org.credil.helloworldservice.permissions.CALL_HELLOTHERE")) == false){
return PERMISSION_DENIED;
}
String16 str = data.readString16();
helloint(String8(str).string());
int tmp= str.size();
printf("servie str.size():%i\n",tmp);
status_t status = reply->writeInt32(tmp);
if( status == NO_ERROR)
printf("file:%s,line:%i,no error\n",__FILE__,__LINE__);
else
printf("file:%s,line:%i, error\n",__FILE__,__LINE__);
return NO_ERROR;
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
return NO_ERROR;
}
示例9: onTransact
status_t BnServiceManager::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
//printf("ServiceManager received: "); data.print();
switch(code) {
case GET_SERVICE_TRANSACTION: {
CHECK_INTERFACE(IServiceManager, data, reply);
String16 which = data.readString16();
sp<IBinder> b = const_cast<BnServiceManager*>(this)->getService(which);
reply->writeStrongBinder(b);
return NO_ERROR;
} break;
case CHECK_SERVICE_TRANSACTION: {
CHECK_INTERFACE(IServiceManager, data, reply);
String16 which = data.readString16();
sp<IBinder> b = const_cast<BnServiceManager*>(this)->checkService(which);
reply->writeStrongBinder(b);
return NO_ERROR;
} break;
case ADD_SERVICE_TRANSACTION: {
CHECK_INTERFACE(IServiceManager, data, reply);
String16 which = data.readString16();
sp<IBinder> b = data.readStrongBinder();
status_t err = addService(which, b);
reply->writeInt32(err);
return NO_ERROR;
} break;
case LIST_SERVICES_TRANSACTION: {
CHECK_INTERFACE(IServiceManager, data, reply);
Vector<String16> list = listServices();
const size_t N = list.size();
reply->writeInt32(N);
for (size_t i=0; i<N; i++) {
reply->writeString16(list[i]);
}
return NO_ERROR;
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例10: receiveUnsolicited
void PhoneMachine::receiveUnsolicited(const Parcel& data)
{
int message = data.readInt32();
int ivalue = 0;
String16 svalue;
UnsolicitedMessages flags = UM_NONE;
MAPTYPE *pmap = eventmap;
SLOGD("<<< Unsolicited message=%s [%d]\n", rilMessageStr(message), message);
while (pmap->flags != UM_NONE && message != pmap->message)
pmap++;
if (pmap->flags)
flags = pmap->flags;
switch (message) {
case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED:
ivalue = data.readInt32();
SLOGD(" RIL Radio state changed to %d\n", ivalue);
if (ivalue == RADIO_STATE_OFF) {
RILRequest * request = new RILRequest(NULL, -1, RIL_REQUEST_RADIO_POWER);
request->writeInt(1); // One value
request->writeInt(1); // Turn the radio on
sendToRILD(request);
}
break;
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED:
sendToRILD(new RILRequest(NULL, -1, RIL_REQUEST_GET_CURRENT_CALLS));
break;
case RIL_UNSOL_NITZ_TIME_RECEIVED:
svalue = data.readString16();
break;
case RIL_UNSOL_SIGNAL_STRENGTH:
ivalue = data.readInt32();
SLOGD(" Signal strength changed %d\n", ivalue);
break;
#if defined(SHORT_PLATFORM_VERSION) && (SHORT_PLATFORM_VERSION == 23)
#else
case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED:
break;
case RIL_UNSOL_RIL_CONNECTED: {
int n = data.readInt32(); // Number of integers
ivalue = data.readInt32(); // RIL Version
SLOGD(" RIL connected version=%d\n", ivalue);
break;
}
#endif
default:
SLOGD("### Unhandled unsolicited message received from RIL: %d\n", message);
break;
}
if (flags)
mService->broadcastUnsolicited(flags, message, ivalue, svalue);
}
示例11: _setResult
static jint _setResult(JNIEnv* env, jobject obj, jobject java_result)
{
sp<DMRDeviceClient> dmr_device = getDMRDeviceClient(env, obj);
if (dmr_device == NULL ) {
return UNKNOWN_ERROR;
}
Parcel *result = parcelForJavaObject(env, java_result);
String8 order(result->readString16());
return dmr_device->setResult(order);
}
示例12: onTransact
status_t BnChatSessionManager::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
status_t result = 0x80000000;
_TRACE("ChatSessionManager::onTransact[pid:%d] >>:code 0x%x",GetCallerPID(),code); //data.print();
switch(code) {
case ICSM_GetSessionNames: {
CHECK_INTERFACE(IChatSessionManager, data, reply);
Vector<String16> list = GetSessionNames();
const size_t N = list.size();
reply->writeInt32(N);
for (size_t i=0; i<N; i++) {
reply->writeString16(list[i]);
}
result = NO_ERROR;
} break;
case ICSM_FindSession: {
CHECK_INTERFACE(IChatSessionManager, data, reply);
String16 name = data.readString16();
BOOL bDontCreate = data.readInt32();
BOOL bAllowAnonymousAccess = data.readInt32();
sp<IChatSession> b = FindSession(name,bDontCreate,bAllowAnonymousAccess);
reply->writeStrongBinder(b->asBinder());
result = NO_ERROR;
} break;
case ICSM_DeleteSession: {
CHECK_INTERFACE(IChatSessionManager, data, reply);
String16 name = data.readString16();
status_t err = DeleteSession(name);
reply->writeInt32(err);
result = NO_ERROR;
} break;
default:
result = BBinder::onTransact(code, data, reply, flags);
}
_TRACE("ChatSessionManager::onTransact[pid:%d] <<:result %d",GetCallerPID(),result); //reply.print();
return result;
}
示例13: onTransact
status_t BnMountServiceListener::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case TRANSACTION_onUsbMassStorageConnectionChanged: {
CHECK_INTERFACE(IMountServiceListener, data, reply);
bool connected = (data.readInt32() != 0);
onUsbMassStorageConnectionChanged(connected);
reply->writeNoException();
return NO_ERROR;
} break;
case TRANSACTION_onStorageStateChanged: {
CHECK_INTERFACE(IMountServiceListener, data, reply);
String16 path = data.readString16();
String16 oldState = data.readString16();
String16 newState = data.readString16();
onStorageStateChanged(path, oldState, newState);
reply->writeNoException();
return NO_ERROR;
}
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例14: onTransact
status_t Service::onTransact(uint32_t code,
const Parcel &data,
Parcel *reply,
uint32_t flags)
{
CHECK_INTERFACE(IHelloWorld, data, reply);
if (code == HW_SAYHELLO)
{
if (checkCallingPermission(String16("cn.bjtu.helloworldservice.permissions.CALL_SAYHELLO")) == false)
return PERMISSION_DENIED;
String16 str = data.readString16();
sayHello(String8(str).string());
return NO_ERROR;
}
return BBinder::onTransact(code, data, reply, flags);
}
示例15: queryExtnIface
status_t PVPlayerExtensionHandler::queryExtnIface(const Parcel& data, Parcel& reply)
{
String16 iface= data.readString16();
IDispatch* extPtr = NULL;
extPtr = mPVPlayerExtnIfaceRegistry.createExtension(iface,*this);
if (extPtr){
LOGV("PVPlayerExtensionHandler::queryExtnIface extIface=%d",(int32_t)extPtr);
status_t status = reply.writeInt32(NO_ERROR);
if (NO_ERROR != status){
return INVALID_OPERATION;
}
iExtensionInstancesList.add_element(extPtr);
return reply.writeInt32((int32_t)extPtr);
} else {
return reply.writeInt32(NAME_NOT_FOUND);
}
}