mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 20:16:16 +02:00
more DataServerClient API tweaks
This commit is contained in:
parent
3613773b79
commit
e08f4d2eba
5 changed files with 34 additions and 34 deletions
|
@ -1854,8 +1854,8 @@ void Application::init() {
|
|||
|
||||
if (!_profile.getUsername().isEmpty()) {
|
||||
// we have a username for this avatar, ask the data-server for the mesh URL for this avatar
|
||||
DataServerClient::getClientValueForKey(DataServerKey::FaceMeshURL, _profile.getUsername(), &_profile);
|
||||
DataServerClient::getClientValueForKey(DataServerKey::SkeletonURL, _profile.getUsername(), &_profile);
|
||||
DataServerClient::getValueForKeyAndUserString(DataServerKey::FaceMeshURL, _profile.getUserString(), &_profile);
|
||||
DataServerClient::getValueForKeyAndUserString(DataServerKey::SkeletonURL, _profile.getUserString(), &_profile);
|
||||
}
|
||||
|
||||
// Set up VoxelSystem after loading preferences so we can get the desired max voxel count
|
||||
|
|
|
@ -830,9 +830,9 @@ void Menu::editPreferences() {
|
|||
applicationInstance->getProfile()->setFaceModelURL(faceModelURL);
|
||||
|
||||
// send the new face mesh URL to the data-server (if we have a client UUID)
|
||||
DataServerClient::putValueForKeyAndUsername(DataServerKey::FaceMeshURL,
|
||||
faceModelURL.toString().toLocal8Bit().constData(),
|
||||
applicationInstance->getProfile()->getUsername());
|
||||
DataServerClient::putValueForKeyAndUserString(DataServerKey::FaceMeshURL,
|
||||
faceModelURL.toString().toLocal8Bit().constData(),
|
||||
applicationInstance->getProfile()->getUserString());
|
||||
}
|
||||
|
||||
QUrl skeletonModelURL(skeletonURLEdit->text());
|
||||
|
@ -842,9 +842,9 @@ void Menu::editPreferences() {
|
|||
applicationInstance->getProfile()->setSkeletonModelURL(skeletonModelURL);
|
||||
|
||||
// send the new skeleton model URL to the data-server (if we have a client UUID)
|
||||
DataServerClient::putValueForKeyAndUsername(DataServerKey::SkeletonURL,
|
||||
skeletonModelURL.toString().toLocal8Bit().constData(),
|
||||
applicationInstance->getProfile()->getUsername());
|
||||
DataServerClient::putValueForKeyAndUserString(DataServerKey::SkeletonURL,
|
||||
skeletonModelURL.toString().toLocal8Bit().constData(),
|
||||
applicationInstance->getProfile()->getUserString());
|
||||
}
|
||||
|
||||
applicationInstance->getAvatar()->getHead().setPupilDilation(pupilDilation->value() / (float)pupilDilation->maximum());
|
||||
|
@ -963,7 +963,7 @@ void Menu::goToUser() {
|
|||
int dialogReturn = userDialog.exec();
|
||||
if (dialogReturn == QDialog::Accepted && !userDialog.textValue().isEmpty()) {
|
||||
// there's a username entered by the user, make a request to the data-server
|
||||
DataServerClient::getValuesForKeysAndUsername(
|
||||
DataServerClient::getValuesForKeysAndUserString(
|
||||
QStringList() << DataServerKey::Domain << DataServerKey::Position << DataServerKey::Orientation,
|
||||
userDialog.textValue(), Application::getInstance()->getProfile());
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@ Profile::Profile(const QString &username) :
|
|||
setUsername(username);
|
||||
|
||||
// we've been given a new username, ask the data-server for profile
|
||||
DataServerClient::getClientValueForKey(DataServerKey::UUID, username, this);
|
||||
DataServerClient::getClientValueForKey(DataServerKey::FaceMeshURL, username, this);
|
||||
DataServerClient::getClientValueForKey(DataServerKey::SkeletonURL, username, this);
|
||||
DataServerClient::getValueForKeyAndUserString(DataServerKey::UUID, getUserString(), this);
|
||||
DataServerClient::getValueForKeyAndUserString(DataServerKey::FaceMeshURL, getUserString(), this);
|
||||
DataServerClient::getValueForKeyAndUserString(DataServerKey::SkeletonURL, getUserString(), this);
|
||||
|
||||
// send our current domain server to the data-server
|
||||
updateDomain(NodeList::getInstance()->getDomainHostname());
|
||||
|
@ -70,7 +70,7 @@ void Profile::updateDomain(const QString& domain) {
|
|||
_lastDomain = domain;
|
||||
|
||||
// send the changed domain to the data-server
|
||||
DataServerClient::putValueForKeyAndUsername(DataServerKey::Domain, domain, _username);
|
||||
DataServerClient::putValueForKeyAndUserString(DataServerKey::Domain, domain, getUserString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,8 @@ void Profile::updatePosition(const glm::vec3 position) {
|
|||
gettimeofday(&lastPositionSend, NULL);
|
||||
|
||||
// send the changed position to the data-server
|
||||
DataServerClient::putValueForKeyAndUsername(DataServerKey::Position,
|
||||
QString(createByteArray(position)), _username);
|
||||
DataServerClient::putValueForKeyAndUserString(DataServerKey::Position,
|
||||
QString(createByteArray(position)), getUserString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,8 +116,8 @@ void Profile::updateOrientation(const glm::quat& orientation) {
|
|||
uint64_t now = usecTimestampNow();
|
||||
if (now - _lastOrientationSend >= DATA_SERVER_ORIENTATION_UPDATE_INTERVAL_USECS &&
|
||||
glm::distance(_lastOrientation, eulerAngles) >= DATA_SERVER_ORIENTATION_CHANGE_THRESHOLD_DEGREES) {
|
||||
DataServerClient::putValueForKeyAndUsername(DataServerKey::Orientation, QString(createByteArray(eulerAngles)),
|
||||
_username);
|
||||
DataServerClient::putValueForKeyAndUserString(DataServerKey::Orientation, QString(createByteArray(eulerAngles)),
|
||||
getUserString());
|
||||
|
||||
_lastOrientation = eulerAngles;
|
||||
_lastOrientationSend = now;
|
||||
|
|
|
@ -29,7 +29,7 @@ const HifiSockAddr& DataServerClient::dataServerSockAddr() {
|
|||
return dsSockAddr;
|
||||
}
|
||||
|
||||
void DataServerClient::putValueForKeyAndUsername(const QString& key, const QString& value, const QString& clientIdentifier) {
|
||||
void DataServerClient::putValueForKeyAndUserString(const QString& key, const QString& value, const QString& userString) {
|
||||
unsigned char putPacket[MAX_PACKET_SIZE];
|
||||
|
||||
// setup the header for this packet
|
||||
|
@ -40,8 +40,8 @@ void DataServerClient::putValueForKeyAndUsername(const QString& key, const QStri
|
|||
numPacketBytes += sizeof(_sequenceNumber);
|
||||
|
||||
// pack the client UUID, null terminated
|
||||
memcpy(putPacket + numPacketBytes, qPrintable(clientIdentifier), clientIdentifier.toLocal8Bit().size());
|
||||
numPacketBytes += clientIdentifier.toLocal8Bit().size();
|
||||
memcpy(putPacket + numPacketBytes, qPrintable(userString), userString.size());
|
||||
numPacketBytes += userString.size();
|
||||
putPacket[numPacketBytes++] = '\0';
|
||||
|
||||
// pack a 1 to designate that we are putting a single value
|
||||
|
@ -70,7 +70,7 @@ void DataServerClient::putValueForKeyAndUsername(const QString& key, const QStri
|
|||
}
|
||||
|
||||
void DataServerClient::putValueForKeyAndUUID(const QString& key, const QString& value, const QUuid& uuid) {
|
||||
putValueForKeyAndUsername(key, value, uuidStringWithoutCurlyBraces(uuid));
|
||||
putValueForKeyAndUserString(key, value, uuidStringWithoutCurlyBraces(uuid));
|
||||
}
|
||||
|
||||
void DataServerClient::getValueForKeyAndUUID(const QString& key, const QUuid &uuid, DataServerCallbackObject* callbackObject) {
|
||||
|
@ -79,13 +79,13 @@ void DataServerClient::getValueForKeyAndUUID(const QString& key, const QUuid &uu
|
|||
|
||||
void DataServerClient::getValuesForKeysAndUUID(const QStringList& keys, const QUuid& uuid, DataServerCallbackObject* callbackObject) {
|
||||
if (!uuid.isNull()) {
|
||||
getValuesForKeysAndUsername(keys, uuidStringWithoutCurlyBraces(uuid), callbackObject);
|
||||
getValuesForKeysAndUserString(keys, uuidStringWithoutCurlyBraces(uuid), callbackObject);
|
||||
}
|
||||
}
|
||||
|
||||
void DataServerClient::getValuesForKeysAndUsername(const QStringList& keys, const QString& clientIdentifier,
|
||||
void DataServerClient::getValuesForKeysAndUserString(const QStringList& keys, const QString& userString,
|
||||
DataServerCallbackObject* callbackObject) {
|
||||
if (!clientIdentifier.isEmpty() && keys.size() <= UCHAR_MAX) {
|
||||
if (!userString.isEmpty() && keys.size() <= UCHAR_MAX) {
|
||||
unsigned char getPacket[MAX_PACKET_SIZE];
|
||||
|
||||
// setup the header for this packet
|
||||
|
@ -96,8 +96,8 @@ void DataServerClient::getValuesForKeysAndUsername(const QStringList& keys, cons
|
|||
numPacketBytes += sizeof(_sequenceNumber);
|
||||
|
||||
// pack the user string (could be username or UUID string), null-terminate
|
||||
memcpy(getPacket + numPacketBytes, clientIdentifier.toLocal8Bit().constData(), clientIdentifier.size());
|
||||
numPacketBytes += clientIdentifier.size();
|
||||
memcpy(getPacket + numPacketBytes, qPrintable(userString), userString.size());
|
||||
numPacketBytes += userString.size();
|
||||
getPacket[numPacketBytes++] = '\0';
|
||||
|
||||
// pack one byte to designate the number of keys
|
||||
|
@ -122,9 +122,9 @@ void DataServerClient::getValuesForKeysAndUsername(const QStringList& keys, cons
|
|||
}
|
||||
}
|
||||
|
||||
void DataServerClient::getClientValueForKey(const QString& key, const QString& clientIdentifier,
|
||||
DataServerCallbackObject* callbackObject) {
|
||||
getValuesForKeysAndUsername(QStringList(key), clientIdentifier, callbackObject);
|
||||
void DataServerClient::getValueForKeyAndUserString(const QString& key, const QString& userString,
|
||||
DataServerCallbackObject* callbackObject) {
|
||||
getValuesForKeysAndUserString(QStringList(key), userString, callbackObject);
|
||||
}
|
||||
|
||||
void DataServerClient::processConfirmFromDataServer(unsigned char* packetData) {
|
||||
|
|
|
@ -26,15 +26,15 @@ class DataServerClient {
|
|||
public:
|
||||
static const HifiSockAddr& dataServerSockAddr();
|
||||
|
||||
static void putValueForKeyAndUsername(const QString& key, const QString& value, const QString& clientIdentifier);
|
||||
static void putValueForKeyAndUserString(const QString& key, const QString& value, const QString& userString);
|
||||
static void putValueForKeyAndUUID(const QString& key, const QString& value, const QUuid& uuid);
|
||||
|
||||
static void getClientValueForKey(const QString& key, const QString& _clientIdentifer,
|
||||
DataServerCallbackObject* callbackObject);
|
||||
static void getValueForKeyAndUserString(const QString& key, const QString& userString,
|
||||
DataServerCallbackObject* callbackObject);
|
||||
static void getValueForKeyAndUUID(const QString& key, const QUuid& uuid, DataServerCallbackObject* callbackObject);
|
||||
static void getValuesForKeysAndUUID(const QStringList& keys, const QUuid& uuid, DataServerCallbackObject* callbackObject);
|
||||
static void getValuesForKeysAndUsername(const QStringList& keys, const QString& clientIdentifier,
|
||||
DataServerCallbackObject* callbackObject);
|
||||
static void getValuesForKeysAndUserString(const QStringList& keys, const QString& userString,
|
||||
DataServerCallbackObject* callbackObject);
|
||||
|
||||
static void processMessageFromDataServer(unsigned char* packetData, int numPacketBytes);
|
||||
|
||||
|
|
Loading…
Reference in a new issue