- added ViewFormat for parsing GE queries for Camera and stuff

- Camera now controlled with adjustable alt, tilt, auto roll based on aircraft banking and auto heading based on aircraft heading


git-svn-id: http://moon:8086/svn/software/trunk/projects/FsTrack@129 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2015-01-13 23:12:57 +00:00
parent 5c19b3e189
commit f471a98b52
9 changed files with 363 additions and 40 deletions
+28 -19
View File
@@ -1,6 +1,5 @@
#include "HttpServer.hpp"
HttpServer::HttpServer(int port, const char *pDocDir)
: Thread("Http")
, m_port(port)
@@ -23,36 +22,46 @@ void HttpServer::addListener(IHttpListener *pListener)
const char* HttpServer::getDocName(char *buffer, int buflen)
{
static char docBuffer[1024];
char *pDocname;
char *pDoc = docBuffer;
char *pBuf;
bool hasQuery = false;
strcpy(docBuffer, m_docDir);
pDocname = &docBuffer[strlen(docBuffer)];
*pDocname = '\\';
pDocname++;
int i, off;
pDoc = &docBuffer[strlen(docBuffer)];
*pDoc = '\\';
pDoc++;
if (!stricmp(buffer, "GET"))
{
return nullptr;
}
off = 0;
while(buffer[3+off] == 0x20)
off++;
pBuf = buffer + 3;
while(*pBuf == 0x20)
pBuf++;
while(buffer[3+off] == '/')
off++;
while(*pBuf == '/')
pBuf++;
i = 0;
while(buffer[3+off+i] != 0x20)
int len = 0;
while(*pBuf != 0x20)
{
pDocname[i] = buffer[3+off+i];
i++;
if (*pBuf == '?')
{
hasQuery = true;
break;
}
*pDoc++ = *pBuf++;
len++;
}
pDocname[i] = 0;
*pDoc = 0;
if (i==0)
if (hasQuery)
{
m_viewFormat.parse(pBuf);
}
if (len==0)
return nullptr;
return docBuffer;
@@ -85,7 +94,7 @@ void HttpServer::run()
}
else
{
m_listeners.call(&IHttpListener::onUpdate, pDoc);
m_listeners.call(&IHttpListener::onUpdate, pDoc, m_viewFormat);
}
}