Lines Matching full:buf
40 static void readAppName(MessageBuf &buf, hub_app_name_t &name) {
41 name.id = buf.readU64();
44 static void writeAppName(MessageBuf &buf, const hub_app_name_t &name) {
45 buf.writeU64(name.id);
48 static void readNanohubAppInfo(MessageBuf &buf, NanohubAppInfo &info) {
49 size_t pos = buf.getPos();
50 readAppName(buf, info.name);
51 info.version = buf.readU32();
52 info.flashUse = buf.readU32();
53 info.ramUse = buf.readU32();
54 if ((buf.getPos() - pos) != sizeof(info)) {
59 static void readNanohubMemInfo(MessageBuf &buf, NanohubMemInfo &mi) {
60 size_t pos = buf.getPos();
61 mi.flashSz = buf.readU32();
62 mi.blSz = buf.readU32();
63 mi.osSz = buf.readU32();
64 mi.sharedSz = buf.readU32();
65 mi.eeSz = buf.readU32();
66 mi.ramSz = buf.readU32();
68 mi.blUse = buf.readU32();
69 mi.osUse = buf.readU32();
70 mi.sharedUse = buf.readU32();
71 mi.eeUse = buf.readU32();
72 mi.ramUse = buf.readU32();
73 if ((buf.getPos() - pos) != sizeof(mi)) {
78 NanohubRsp::NanohubRsp(MessageBuf &buf, bool no_status) {
81 cmd = buf.readU8();
82 if (!buf.getSize()) {
87 status = buf.readU32();
119 int SystemComm::AppInfoSession::handleRx(MessageBuf &buf)
123 NanohubRsp rsp(buf, true);
127 size_t len = buf.getRoom();
139 readNanohubAppInfo(buf, info);
171 MessageBuf buf(data, sizeof(data));
172 buf.writeU8(NANOHUB_QUERY_APPS);
173 buf.writeU32(mAppInfo.size());
174 return sendToSystem(buf.getData(), buf.getPos());
185 int SystemComm::GlobalSession::handleRx(MessageBuf &buf)
189 NanohubRsp rsp(buf);
204 MessageBuf buf(data, sizeof(data));
205 buf.writeU8(NANOHUB_QUERY_MEMINFO);
208 return sendToSystem(buf.getData(), buf.getPos());
211 int SystemComm::MemInfoSession::handleRx(MessageBuf &buf)
214 NanohubRsp rsp(buf, true);
219 size_t len = buf.getRoom();
231 readNanohubMemInfo(buf, mi);
283 MessageBuf buf(data, sizeof(data));
303 buf.writeU8(NANOHUB_START_UPLOAD);
304 buf.writeU8(mCmd == CONTEXT_HUB_LOAD_OS ? 1 : 0);
305 buf.writeU32(mLen);
306 return sendToSystem(buf.getData(), buf.getPos());
310 buf.writeU8(NANOHUB_REBOOT);
311 return sendToSystem(buf.getData(), buf.getPos());
325 MessageBuf buf(data, sizeof(data));
326 buf.writeU8(cmd);
327 writeAppName(buf, appName);
330 return sendToSystem(buf.getData(), buf.getPos());
333 int SystemComm::AppMgmtSession::handleRx(MessageBuf &buf)
337 NanohubRsp rsp(buf);
366 MessageBuf buf(data, sizeof(data));
378 buf.writeU8(NANOHUB_CONT_UPLOAD);
379 buf.writeU32(mPos);
380 buf.writeRaw(&mData[mPos], chunkSize);
383 buf.writeU8(NANOHUB_FINISH_UPLOAD);
387 return sendToSystem(buf.getData(), buf.getPos());
401 MessageBuf buf(data, sizeof(data));
403 buf.writeU8(NANOHUB_REBOOT);
405 ret = sendToSystem(buf.getData(), buf.getPos());
488 int SystemComm::KeyInfoSession::handleRx(MessageBuf &buf)
491 NanohubRsp rsp(buf, true);
499 if (buf.getRoom()) {
501 buf.getData() + buf.getPos(),
502 buf.getData() + buf.getSize());
514 MessageBuf buf(data, sizeof(data));
516 buf.writeU8(NANOHUB_QUERY_APPS);
517 buf.writeU32(mRsaKeyData.size());
519 return sendToSystem(buf.getData(), buf.getPos());
532 MessageBuf buf(reinterpret_cast<const char*>(msg->data), msg->hdr.len);
534 dumpBuffer("SYS -> HAL", mHostIfAppName, 0, buf.getData(), buf.getSize());
536 int status = mSessions.handleRx(buf);
540 mHostIfAppName, 0, buf.getData(), buf.getSize(), status);
547 int SystemComm::SessionManager::handleRx(MessageBuf &buf)
556 status = session->handleRx(buf);
562 status = mGlobal.handleRx(buf);