mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:08:54 +02:00
add UUID helper class to get UUID string without braces
This commit is contained in:
parent
13232a4c0b
commit
5a7d21f529
7 changed files with 37 additions and 7 deletions
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include <AvatarData.h>
|
#include <AvatarData.h>
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
|
#include <UUID.h>
|
||||||
#include <VoxelConstants.h>
|
#include <VoxelConstants.h>
|
||||||
|
|
||||||
#include "Agent.h"
|
#include "Agent.h"
|
||||||
|
@ -50,7 +51,7 @@ void Agent::run() {
|
||||||
// figure out the URL for the script for this agent assignment
|
// figure out the URL for the script for this agent assignment
|
||||||
QString scriptURLString("http://%1:8080/assignment/%2");
|
QString scriptURLString("http://%1:8080/assignment/%2");
|
||||||
scriptURLString = scriptURLString.arg(NodeList::getInstance()->getDomainIP().toString(),
|
scriptURLString = scriptURLString.arg(NodeList::getInstance()->getDomainIP().toString(),
|
||||||
this->getUUIDStringWithoutCurlyBraces());
|
uuidStringWithoutCurlyBraces(_uuid));
|
||||||
|
|
||||||
// setup curl for script download
|
// setup curl for script download
|
||||||
CURLcode curlResult;
|
CURLcode curlResult;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
#include <UUID.h>
|
||||||
|
|
||||||
#include "DomainServer.h"
|
#include "DomainServer.h"
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ void DomainServer::civetwebUploadHandler(struct mg_connection *connection, const
|
||||||
QString newPath(ASSIGNMENT_SCRIPT_HOST_LOCATION);
|
QString newPath(ASSIGNMENT_SCRIPT_HOST_LOCATION);
|
||||||
newPath += "/";
|
newPath += "/";
|
||||||
// append the UUID for this script as the new filename, remove the curly braces
|
// append the UUID for this script as the new filename, remove the curly braces
|
||||||
newPath += scriptAssignment->getUUIDStringWithoutCurlyBraces();
|
newPath += uuidStringWithoutCurlyBraces(scriptAssignment->getUUID());
|
||||||
|
|
||||||
// rename the saved script to the GUID of the assignment and move it to the script host locaiton
|
// rename the saved script to the GUID of the assignment and move it to the script host locaiton
|
||||||
rename(path, newPath.toLocal8Bit().constData());
|
rename(path, newPath.toLocal8Bit().constData());
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
|
|
||||||
#include "DataServerClient.h"
|
#include "DataServerClient.h"
|
||||||
|
|
||||||
|
QUuid DataServerClient::_clientUUID;
|
||||||
|
std::vector<unsigned char*> DataServerClient::_unconfirmedPackets;
|
||||||
|
|
||||||
const char DATA_SERVER_HOSTNAME[] = "data.highfidelity.io";
|
const char DATA_SERVER_HOSTNAME[] = "data.highfidelity.io";
|
||||||
const unsigned short DATA_SERVER_PORT = 3282;
|
const unsigned short DATA_SERVER_PORT = 3282;
|
||||||
const sockaddr_in DATA_SERVER_SOCKET = socketForHostnameAndHostOrderPort(DATA_SERVER_HOSTNAME, DATA_SERVER_PORT);
|
const sockaddr_in DATA_SERVER_SOCKET = socketForHostnameAndHostOrderPort(DATA_SERVER_HOSTNAME, DATA_SERVER_PORT);
|
||||||
|
|
|
@ -139,10 +139,6 @@ void Assignment::setPayload(const uchar* payload, int numBytes) {
|
||||||
memcpy(_payload, payload, _numPayloadBytes);
|
memcpy(_payload, payload, _numPayloadBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Assignment::getUUIDStringWithoutCurlyBraces() const {
|
|
||||||
return _uuid.toString().mid(1, _uuid.toString().length() - 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
int Assignment::packToBuffer(unsigned char* buffer) {
|
int Assignment::packToBuffer(unsigned char* buffer) {
|
||||||
int numPackedBytes = 0;
|
int numPackedBytes = 0;
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ public:
|
||||||
|
|
||||||
void setUUID(const QUuid& uuid) { _uuid = uuid; }
|
void setUUID(const QUuid& uuid) { _uuid = uuid; }
|
||||||
const QUuid& getUUID() const { return _uuid; }
|
const QUuid& getUUID() const { return _uuid; }
|
||||||
QString getUUIDStringWithoutCurlyBraces() const;
|
|
||||||
void resetUUID() { _uuid = QUuid::createUuid(); }
|
void resetUUID() { _uuid = QUuid::createUuid(); }
|
||||||
|
|
||||||
Assignment::Command getCommand() const { return _command; }
|
Assignment::Command getCommand() const { return _command; }
|
||||||
|
|
14
libraries/shared/src/UUID.cpp
Normal file
14
libraries/shared/src/UUID.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
//
|
||||||
|
// UUID.cpp
|
||||||
|
// hifi
|
||||||
|
//
|
||||||
|
// Created by Stephen Birarda on 10/7/13.
|
||||||
|
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "UUID.h"
|
||||||
|
|
||||||
|
QString uuidStringWithoutCurlyBraces(const QUuid& uuid) {
|
||||||
|
QString uuidStringNoBraces = uuid.toString().mid(1, uuid.toString().length() - 2);
|
||||||
|
return uuidStringNoBraces;
|
||||||
|
}
|
16
libraries/shared/src/UUID.h
Normal file
16
libraries/shared/src/UUID.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
//
|
||||||
|
// UUID.h
|
||||||
|
// hifi
|
||||||
|
//
|
||||||
|
// Created by Stephen Birarda on 10/7/13.
|
||||||
|
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __hifi__UUID__
|
||||||
|
#define __hifi__UUID__
|
||||||
|
|
||||||
|
#include <QtCore/QUuid>
|
||||||
|
|
||||||
|
QString uuidStringWithoutCurlyBraces(const QUuid& uuid);
|
||||||
|
|
||||||
|
#endif /* defined(__hifi__UUID__) */
|
Loading…
Reference in a new issue