bool VR_DataAccessorNaviCN::getInfo(const std::string &operation, const std::string &reqMsg, std::string &response)
{
    VR_LOGD_FUNC();
    VR_LOGD("Operation [%s]\nreqMsg [%s]", operation.c_str(), reqMsg.c_str());

    NaviOperation op = NaviOperation::None;
    if (m_operationMap.end() != m_operationMap.find(operation)) {
        op = m_operationMap[operation];
    }
    switch (op) {
    case NaviOperation::AddressMapping:
        {
            return addressMapping(reqMsg, response);
        }
    case NaviOperation::BuildAddress:
        {
            return buildAddress(reqMsg, response);
        }
    case NaviOperation::BuildPointType:
        {
            return buildPointType(reqMsg, response);
        }
    default:
        {
            return false; // can not find the operation
        }
    }
}
示例#2
0
int main (int argc, const char *argv[])
{
  int sock;
  int i = 0;

  if (argc >1){
    ip = malloc(sizeof(char) * strlen(argv[1]));
    strcpy(ip,argv[1]);
      if (argc >2){
        port = malloc(sizeof(char) * strlen(argv[2]));
        strcpy(port,argv[2]);
        if (argc >3){

          wsName = malloc(sizeof(char) * strlen(argv[3]));
          strcpy(wsName,argv[3]);
        }
      }
  }
  fullDir = buildAddress();
  trace(1, fullDir);
  memset(glob, 0, sizeof(*glob));

  if (!create_listen_sock(FPM_DEFAULT_PORT, &glob->server_sock)) {
    exit(1);
  }

  /*
   * Server forever.
   */
  while (1) {
    glob->sock = accept_conn(glob->server_sock);
    fpm_serve();
    trace(1, "Done serving client");
  }
}
bool VR_DataAccessorNavi::getInfo(const std::string &operation, const std::string &reqMsg, std::string &response)
{
    VR_LOGD_FUNC();
    VR_LOGD("Operation [%s]\nreqMsg [%s]", operation.c_str(), reqMsg.c_str());

    std::string processedReqMsg;
    processRequestMsg(reqMsg, processedReqMsg);
    VR_LOGD("processed reqMsg [%s]", processedReqMsg.c_str());

    NaviOperation op = NaviOperation::None;
    if (m_operationMap.end() != m_operationMap.find(operation)) {
        op = m_operationMap[operation];
    }
    switch (op) {
    case NaviOperation::AddressMapping:
        {
            return addressMapping(processedReqMsg, response);
        }
    case NaviOperation::BuildAddress:
        {
            return buildAddress(processedReqMsg, response);
        }
    case NaviOperation::SendVoiceID:
        {
            return sendVoiceID(processedReqMsg, response);
        }
    case NaviOperation::BuildAddressName:
        {
            return buildAddressName(reqMsg, response);
        }
    case NaviOperation::GetPOIPrompt:
        {
            return getPOIPrompt(reqMsg, response);
        }
    case NaviOperation::BuildPointType:
        {
            return buildPointType(reqMsg, response);
        }
    default:
        {
            return false; // can not find the operation
        }
    }
}
 inet_stream_addr(string port = "80", string address = "localhost"):base_addr(inet_stream_addr::_type), _port(port), _address(address)
 {
     buildAddress();
 }