void GraphCanvas::DrawGraph(uint i, float xmax, float xmin, int x, float xscale, int y, float yscale) const { const Result &res = results[i]; const Color& color = res.color; if (!res.list.size()) { MSG_DEBUG("menu", " No point !?!"); return; } int sx = x+int((res.list[0].first-xmin)*xscale)+thickness, sy = y-int(res.list[0].second*yscale); Surface &surface = GetMainWindow(); MSG_DEBUG("menu", " First point: (%.3f,%.3f) -> (%i,%i)", res.list[0].first, res.list[0].second, sx, sy); for (uint i=0; i<res.list.size(); i++) { const Value& val = res.list[i]; int ex = x+int((val.first-xmin)*xscale), ey = y-int(val.second*yscale); MSG_DEBUG("menu", " Next point: (%.3f,%.3f) -> (%i,%i)", val.first, val.second, ex, ey); surface.BoxColor(Rectanglei(sx, sy, ex-sx, thickness), color); surface.BoxColor(Rectanglei(ex, std::min(sy,ey), thickness, abs(ey-sy)), color); sx = ex; sy = ey; } // Missing point if (res.list[res.list.size()-1].first < xmax) { int ex = x+int((xmax-xmin)*xscale); MSG_DEBUG("menu", " Last point -> (%i,%i)", ex, sy); surface.BoxColor(Rectanglei(sx, sy, ex-sx, thickness), color); } }
/** * \brief Close intermediate plugin * * \param[in] config plugin configuration * \return 0 on success */ int intermediate_close(void *config) { MSG_DEBUG(msg_module, "CLOSING"); plugin_conf *conf = static_cast<plugin_conf*>(config); /* Force update counters */ stats_flush_counters(conf, true); /* Destroy configuration */ delete conf; return 0; }
bool CXsiObjConverter::DotXSILoadModel(CSLModel* pModel, std::string& modelName) { OBJ_ASSERT(pModel); if(!pModel) return false; // Get the model's name modelName = pModel->GetName(); MSG_DEBUG("Model Name: " << modelName); return true; }
/** * \brief Main loop */ void Scanner::loop() { prctl(PR_SET_NAME, "fbitexp:Scanner\0", 0, 0, 0); std::mutex mtx; std::unique_lock<std::mutex> lock(mtx); MSG_DEBUG(msg_module, "started"); while (!_done) { /* * This is before waiting because we want to check size on startup before * any scan or add requests */ if (totalSize() > _max_size) { removeDirs(); } MSG_DEBUG(msg_module, "Total size: %s, Max: %s, Watermark: %s", sizeToStr(totalSize()).c_str(), sizeToStr(_max_size).c_str(), sizeToStr(_watermark).c_str()); _cv.wait(lock, [&]{ return scanCount() > 0 || addCount() > 0 || _done || totalSize() > _max_size; }); if (_done) { break; } /* Add dirs from queue */ if (addCount() > 0) { addNewDirs(); } /* Scan dirs in queue */ if (scanCount() > 0) { rescanDirs(); } } MSG_DEBUG(msg_module, "closing thread"); }
void ObjectsList::PlaceBarrels() { MSG_DEBUG("lst_objects","Placing barrels"); for (uint i= 0; i<ActiveMap()->LoadedData()->GetNbBarrel(); ++i) { PetrolBarrel *obj = new PetrolBarrel(); if (obj->PutRandomly(false, 20.0)) push_back(obj); else delete obj; } }
/** * \brief Compute directory size * * \param path Directory path * \param recursive If true, recursively compute size of subfolders * \return Directory size in bytes */ uint64_t Directory::dirSize(std::string path, bool force, bool recursive, bool writestats) { std::string entry_path, entry_name; struct dirent *entry; struct stat st; uint64_t size{0}; MSG_DEBUG(msg_module, "scanning %s", path.c_str()); std::string statsfile(path + "/stats.txt"); if (!force && stat(statsfile.c_str(), &st)) { /* stats.txt not exists - force scan*/ force = true; } if (!force) { MSG_DEBUG(msg_module, "reading %s", statsfile.c_str()); std::ifstream sfile(statsfile, std::ios::in); sfile >> size; sfile.close(); return size; }
void Single_Scene::outpost_notice_exit(const int64_t monster_role_id, bool clear_single){ if(monster_role_id != 0){ Mover* mover = this->find_mover_with_layer(0, monster_role_id); if(mover && mover->monster_self()){ mover->exit_move_scene(); } } if(clear_single){ this->set_scene_status(Move_Scene::SCENE_RECOVER_STATUS); MSG_DEBUG("single scene recover outpost notice, scene id:%ld", this->scene_id()); recover_time_ = Time_Value::zero; } }
int MsgGetMsgTypeHandler(const MSG_CMD_S *pCmd, char **ppEvent) { msg_error_t err = MSG_SUCCESS; char* encodedData = NULL; AutoPtr<char> buf(&encodedData); int dataSize = 0, eventSize = 0; // Get Message ID msg_message_id_t msgId; memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_id_t)); // Get Msg Type MSG_MESSAGE_TYPE_S msgType; err = MsgStoGetMsgType(msgId, &msgType); if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoGetMsgType()"); // Encoding Storage List Data dataSize = MsgEncodeMsgType(&msgType, &encodedData); } else { MSG_DEBUG("Command Handle Fail : MsgStoGetMsgType()"); } // Make Event Data eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_MSG_TYPE, err, (void**)ppEvent); return eventSize; }
int MsgCountMsgByContactHandler(const MSG_CMD_S *pCmd, char **ppEvent) { msg_error_t err = MSG_SUCCESS; // Get From address MSG_THREAD_LIST_INDEX_S addrInfo; memcpy(&addrInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_THREAD_LIST_INDEX_S)); char* encodedData = NULL; AutoPtr<char> buf(&encodedData); int dataSize = 0, eventSize = 0; // Get Message Common Info MSG_THREAD_COUNT_INFO_S threadCountInfo = {0}; err = MsgStoCountMsgByContact(&addrInfo, &threadCountInfo); if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoCountMsgByContact()"); // Encoding Folder View List Data dataSize = MsgEncodeMsgGetContactCount(&threadCountInfo, &encodedData); MSG_DEBUG("dataSize [%d]", dataSize); } else { MSG_DEBUG("Command Handle Fail : MsgStoCountMsgByContact()"); } // Make Event Data eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_CONTACT_COUNT, err, (void**)ppEvent); return eventSize; }
int MsgSoundGetUnreadMsgCnt() { int unreadCnt = 0; /* Get SMS Count */ unreadCnt = MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_SMS_STATE); /* Get MMS Count */ unreadCnt += MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_MMS_STATE); MSG_DEBUG("unread count : [%d]", unreadCnt); return unreadCnt; }
static int MsgSoundPlayCallback(int message, void *param, void *user_param) { switch (message) { case MM_MESSAGE_ERROR: MSG_DEBUG("ERROR is happened."); g_idle_add (MsgUninitAndExit, NULL); break; case MM_MESSAGE_BEGIN_OF_STREAM: MSG_DEBUG("Play is started."); break; case MM_MESSAGE_END_OF_STREAM: case MM_MESSAGE_STATE_INTERRUPTED: MSG_DEBUG("EOS or Interrupted."); g_idle_add (MsgStopAndExit, NULL); break; default: MSG_DEBUG("message = %d", message); break; } return 1; }
char* MsgSettingGetString(const char *pKey) { if (pKey == NULL) { MSG_DEBUG("IN Parameter is NULL"); return NULL; } #ifdef USE_GCONF return gconf_client_get_string((GConfClient*)pClient, pKey, NULL); #else return vconf_get_str(pKey); #endif }
void ObjectsList::PlaceMines() { MSG_DEBUG("lst_objects","Placing mines"); for (uint i=0; i<ActiveMap()->LoadedData()->GetNbMine(); ++i) { ObjMine *obj = new ObjMine(*MineConfig::GetInstance()); Double detection_range_factor = 1.5; if (obj->PutRandomly(false, MineConfig::GetInstance()->detection_range * PIXEL_PER_METER * detection_range_factor)) // detection range is in meter push_back(obj); else delete obj; } }
/** * \brief Create new maintainer of an Observation Domain ID * \param[in] odid Observation Domain ID (ODID) * \return Pointer or NULL */ static fwd_odid_t *fwd_odid_create(uint32_t odid) { fwd_odid_t *res = calloc(1, sizeof(*res)); if (!res) { MSG_ERROR(msg_module, "Memory allocation failed (%s:%d)", __FILE__, __LINE__); return NULL; } res->odid = odid; MSG_DEBUG(msg_module, "ODID %" PRIu32 " maintainer created.", odid); return res; }
void PhysicalObj::Ghost() { if (m_alive == GHOST) return; bool was_dead = IsDead(); m_alive = GHOST; MSG_DEBUG("physic.state", "%s - Ghost, was_dead = %d", GetName().c_str(), was_dead); // The object became a gost StopMoving(); SignalGhostState(was_dead); }
void PhysicalObj::Collide(collision_t collision, PhysicalObj* collided_obj, const Point2d& position) { Point2d contactPos; Double contactAngle; switch (collision) { case NO_COLLISION: // Nothing more to do! return; case COLLISION_ON_GROUND: ContactPointAngleOnGround(position, contactPos, contactAngle); ASSERT(!collided_obj); break; case COLLISION_ON_OBJECT: contactPos = position; contactAngle = - GetSpeedAngle(); // Compute the new speed norm of this and collided_obj, new speed angle will be set // thanks to Rebound() // Get the current speed Double v1, v2, mass1, angle1, angle2, mass2; collided_obj->GetSpeed(v1, angle1); GetSpeed(v2, angle2); mass1 = GetMass(); mass2 = collided_obj->GetMass(); // Give speed to the other object // thanks to physic and calculations about chocs, we know that : // // v'1 = ((m1 - m2) * v1 + 2m1 *v2) / (m1 + m2) // v'2 = ((m2 - m1) * v2 + 2m1 *v1) / (m1 + m2) collided_obj->SetSpeed(abs(((mass1 - mass2) * v1 + 2 * mass1 *v2 * m_cfg.m_rebound_factor) / (mass1 + mass2)), angle1); SetSpeed(abs(((mass2 - mass1) * v2 + 2 * mass1 *v1 * m_cfg.m_rebound_factor) / (mass1 + mass2)), angle2); break; } // Mark it as last collided object m_last_collided_object = collided_obj; // Make it rebound!! MSG_DEBUG("physic.state", "%s rebounds at %.3f,%.3f", GetName().c_str(), contactPos.x.tofloat(), contactPos.y.tofloat()); Rebound(contactPos, contactAngle); CheckRebound(); }
void MsgProxyListener::start() { if (running == 0) { mx.lock(); cliSock.connect(MSG_SOCKET_PATH); cv.signal(); // wake up the waiting thread mx.unlock(); int fd = cliSock.fd(); MSG_DEBUG("Socket Fd : %d", fd); channel = g_io_channel_unix_new(fd); // initializes ref_count = 1 eventSourceId = g_io_add_watch(channel, (GIOCondition)(G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL), &readSocket, NULL); // increments ref_count =2 MSG_DEBUG("Call g_io_add_watch() : %d", eventSourceId); } running++; MSG_DEBUG("add Listener and [%d] are running.", running); }
int JukeBox::PlaySample(Mix_Chunk * sample, float level, int loop) { if (loop != -1) loop--; Mix_VolumeChunk(sample, int(0.5f+level*Config::GetInstance()->GetVolumeEffects())); int channel = Mix_PlayChannel(-1, sample, loop); if (channel == -1) { MSG_DEBUG("jukebox", "Error: Jukebox::PlaySample: %s", Mix_GetError()); m_cache.FreeChunk(sample); } else chunks[channel] = sample; return channel; }
bool MsgProxyListener::regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_mms_conf_msg_incoming_cb pfNewMMSConfMessage, const char *pAppId, void *pUserParam) { MutexLocker lock(mx); std::list<MSG_MMS_CONF_INCOMING_CB_ITEM_S>::iterator it = newMMSConfMessageCBList.begin(); for (; it != newMMSConfMessageCBList.end(); it++) { if (it->pfMMSConfIncomingCB == pfNewMMSConfMessage) { if(pAppId == NULL) { MSG_DEBUG("msg_mms_conf_msg_incoming_cb() callback is already registered!!!"); return false; } else if(!strncmp(it->appId, pAppId, MAX_MMS_JAVA_APPID_LEN)) { MSG_DEBUG("msg_mms_conf_msg_incoming_cb() callback : AppId [%s] is already registered!!!", pAppId); it->userParam = pUserParam; return false; } } } MSG_MMS_CONF_INCOMING_CB_ITEM_S incomingConfCB = {pMsgHandle, pfNewMMSConfMessage, {0}, pUserParam}; if (pAppId != NULL) strncpy(incomingConfCB.appId, pAppId, MAX_MMS_JAVA_APPID_LEN); newMMSConfMessageCBList.push_back(incomingConfCB); return true; }
msg_error_t MmsUpdateRejectStatus(MSG_MESSAGE_INFO_S *pMsgInfo) { MSG_BEGIN(); msg_error_t err = MSG_SUCCESS; try { char szTrID[MMS_TR_ID_LEN + 1] = {0x00}; bool bReportAllowed; err = MmsPluginStorage::instance()->getTrID(pMsgInfo,szTrID,sizeof(szTrID)); if (err != MSG_SUCCESS) MSG_DEBUG("MmsPlgUpdRejectStatus : Get MMS Transacation id Failed"); memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1); MsgSettingGetBool(MMS_SEND_REPORT_ALLOWED, &bReportAllowed); if (MmsPluginInternal::instance()->encodeNotifyRespInd(szTrID, MSG_DELIVERY_REPORT_REJECTED, bReportAllowed, pMsgInfo->msgData)) { MSG_DEBUG("MmsPlgUpdRejectStatus : Encode Notify Response Success"); pMsgInfo->dataSize = strlen(pMsgInfo->msgData); pMsgInfo->bTextSms = true; } else MSG_DEBUG("MmsPlgSetRejectStatus : Encode Notify Response Failed"); } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_STORAGE; } catch (exception& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_PLUGIN_STORAGE; } if (err != MSG_SUCCESS) MSG_DEBUG("MmsPlgSetRejectStatus : Update MMS Message Failed"); MSG_END(); return err; }
int MsgSoundPlayMelody(char *pMsgToneFilePath, bool bIncreasing) { int err = MM_ERROR_NONE; /* Setting fade in,out */ err = mm_player_set_attribute(hPlayerHandle, NULL, "sound_priority", 2, NULL); if (err != MM_ERROR_NONE) { MSG_DEBUG("error setting the profile attr"); return err; } /* Setting the Volume */ err = mm_player_set_attribute(hPlayerHandle, NULL, "sound_volume_type", MM_SOUND_VOLUME_TYPE_NOTIFICATION, "profile_uri", pMsgToneFilePath, strlen(pMsgToneFilePath), NULL); if (err != MM_ERROR_NONE) { MSG_DEBUG("error setting the profile attr"); return err; } err = mm_player_realize(hPlayerHandle); if (err != MM_ERROR_NONE) { MSG_DEBUG("mm_player_realize() error : [%d]", err); return err; } /* Add Timer to stop playing after 5 sec. */ int g_contact_timer = -1; g_contact_timer = g_timeout_add(5500, (GSourceFunc)MsgSoundMelodyTimeout, NULL); err = mm_player_start(hPlayerHandle); if (err != MM_ERROR_NONE) { MSG_DEBUG("mm_player_start, FAIL [%x]", err); bPlaying = false; return err; } bPlaying = true; pthread_mutex_lock(&muMmPlay); while (bPlaying) { MSG_DEBUG("Ring Alert Playing"); pthread_cond_wait(&cvMmPlay, &muMmPlay); } pthread_mutex_unlock(&muMmPlay); MSG_DEBUG("Ring Alert Idle"); return err; }
int MsgMoveMessageToFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) { msg_error_t err = MSG_SUCCESS; int eventSize = 0; msg_message_id_t msgId; msg_folder_id_t folderId; memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_id_t)); memcpy(&folderId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), sizeof(msg_folder_id_t)); // Move Message err = MsgStoMoveMessageToFolder(msgId, folderId); if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoMoveMessageToFolder()"); msg_id_list_s msgIdList; msg_message_id_t msgIds[1]; memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); msgIdList.nCount = 1; msgIds[0] = msgId; msgIdList.msgIdList = msgIds; MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); } else { MSG_DEBUG("Command Handle Fail : MsgStoMoveMessageToFolder()"); } // Make Event Data eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_MOVE_MSGTOFOLDER, err, (void**)ppEvent); return eventSize; }
int storage_close (void **config) { MSG_DEBUG(msg_module, "CLOSING"); struct json_conf *conf = (struct json_conf *) *config; /* Destroy storage */ delete conf->storage; /* Destroy configuration */ delete conf; *config = NULL; return 0; }
void Vip::vip_level_change(uint32_t new_vip_level, uint32_t old_vip_level) { MSG_DEBUG("player:%ld , vip_level_change new_level:%d, old_level: %d", player_self()->role_id(), new_vip_level, old_vip_level); player_self()->dragon_vale_listen_vip_level_chance(new_vip_level); player_self()->arena_listen_vip_level_change(new_vip_level, old_vip_level); player_self()->mount_listen_vip_level_change(new_vip_level, old_vip_level); ACTIVE_CONTENT_MANAGER->listen_all_player_vip_level_change(new_vip_level, old_vip_level, player_self()); if (player_self()->gang_id()) { GANG_MANAGER->notify_ganger_row_info(GANG_ROW_INFO_UPDATE, role_id(), player_self()->gang_id()); } player_self()->active_content_listen_vip_level_change(new_vip_level); player_self()->task_listen_vip_level_change(new_vip_level); //同步到聊天服 sync_vip_info_to_chat(); }
void GridMeterVector::setup() { GridMeter::setup(); if (m_colour == ALL_COLOURS) throw gError("GridMeterVector::setup", "Please specify a species."); m_moment_o = M_GRID_AVERAGER->format().addAttribute (m_species + STR_DELIMITER + m_name + "^" + ObjToString(m_moment), DataFormat::VECTOR_POINT).offset; m_offset = Particle::s_tag_format[m_colour].attrByName(m_name).offset; MSG_DEBUG("GridMeterVector::setup", "m_offset = " << m_offset << ", m_name = " << m_name); }
msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo) { // Add Submit SMS into DB if ((pReqInfo->msgInfo.msgId == 0) && pReqInfo->msgInfo.msgPort.valid == false) { if (SmsPluginStorage::instance()->addMessage(&(pReqInfo->msgInfo)) != MSG_SUCCESS) { MSG_DEBUG("######## addMessage Fail !!"); return MSG_ERR_PLUGIN_STORAGE; } } // Check SIM is present or not MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED); if (simStatus == MSG_SIM_STATUS_NOT_FOUND) { MSG_DEBUG("SIM is not present.."); // Update Msg Status if (pReqInfo->msgInfo.msgPort.valid == false) SmsPluginStorage::instance()->updateSentMsg(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); return MSG_ERR_NO_SIM; } SMS_REQUEST_INFO_S request = {}; request.reqId = pReqInfo->reqId; memcpy(&(request.msgInfo), &(pReqInfo->msgInfo), sizeof(MSG_MESSAGE_INFO_S)); memcpy(&(request.sendOptInfo), &(pReqInfo->sendOptInfo), sizeof(MSG_SENDINGOPT_INFO_S)); // Add Request into Queue and Start UA Manger SmsPluginUAManager::instance()->addReqEntity(request); return MSG_SUCCESS; }
msg_error_t SmsPlgCheckDeviceStatus() { MSG_BEGIN(); if (!pTapiHandle) return MSG_ERR_PLUGIN_TAPIINIT; int status = 0, tapiRet = TAPI_API_SUCCESS; tapiRet = tel_check_sms_device_status(pTapiHandle, &status); if (tapiRet != TAPI_API_SUCCESS) { MSG_DEBUG("tel_check_sms_device_status() Error! [%d], Status [%d]", tapiRet, status); return MSG_ERR_PLUGIN_TAPI_FAILED; } if (status == 1) { MSG_DEBUG("Device Is Ready"); return MSG_SUCCESS; } else if (status == 0) { MSG_DEBUG("Device Is Not Ready.. Waiting For Ready Callback"); if (SmsPluginEventHandler::instance()->getDeviceStatus() == true) { MSG_DEBUG("Device Is Ready"); return MSG_SUCCESS; } } return MSG_SUCCESS; }
int MsgProxyListener::getRemoteFd() { MutexLocker lock(mx); int tmpFd = cliSock.getRemoteFd(); MSG_DEBUG("listener fd [%d]", tmpFd); if( tmpFd == -1 ) { cv.wait(mx.pMutex()); } return cliSock.getRemoteFd(); }
int MsgGetQuickPanelDataHandler(const MSG_CMD_S *pCmd, char **ppEvent) { msg_error_t err = MSG_SUCCESS; // Get Message ID msg_quickpanel_type_t* type = (msg_quickpanel_type_t*)pCmd->cmdData; char* encodedData = NULL; AutoPtr<char> buf(&encodedData); int dataSize = 0, eventSize = 0; // Get Message MSG_MESSAGE_INFO_S msgInfo; memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); err = MsgStoGetQuickPanelData(*type, &msgInfo); if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoGetQuickPanelData()"); // Encoding Message Info Data dataSize = MsgEncodeMsgInfo(&msgInfo, &encodedData); } else { MSG_DEBUG("Command Handle Fail : MsgStoGetQuickPanelData()"); } // Make Event Data eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_QUICKPANEL_DATA, err, (void**)ppEvent); return eventSize; }
const char *read_value(const char *line, const char *key) { size_t i; /* skip whitespace */ for (i = 0; isspace(line[0]); i++); if (strncmp(&line[i], key, strlen(key))) { MSG_DEBUG(MSG_MODULE, "reading value of '%s' failed: key differ", key); return NULL; } for (i += strlen(key); isspace(line[i]); i++); if (line[i] != '=') { MSG_DEBUG(MSG_MODULE, "reading value of '%s' failed: invalid format", key); return NULL; } for (i++; isspace(line[i]); i++); MSG_DEBUG(MSG_MODULE, "reading value of '%s': %s", key, &line[i]); return &line[i]; }