Skip to content

Commit

Permalink
Merge pull request #1 from shao0099876/qt
Browse files Browse the repository at this point in the history
Qt
  • Loading branch information
shao0099876 authored Jul 1, 2019
2 parents ddb1ff8 + 083d1d1 commit e1e4d9a
Show file tree
Hide file tree
Showing 64 changed files with 5,749 additions and 0 deletions.
Binary file added YJDB.db
Binary file not shown.
11 changes: 11 additions & 0 deletions cgi-bin/aaa.cgi~
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
!/bin/sh

#test1.cgi
echo "Content-Type:text/html\n\r\n"
echo ""
echo ""
echo "hello!"
echo "\n\r\n"
echo "the time is:"
echo "\n\r\n"
date
30 changes: 30 additions & 0 deletions cgi-bin/addpoint.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"tools.h"
#include"/arm2410cl/Trolltech/qt-embedded-4.4.0/myqt/YJSQLite.h"
#define DEBUG 0
int main(){
printf("Content-type: text/html\n\n");
char* type=getenv("CONTENT_TYPE");
int length=atoi(getenv("CONTENT_LENGTH"));
if(strcmp(type,"application/x-www-form-urlencoded")==0){
char *a=(char*)malloc(sizeof(char)*100);
fread(a, sizeof(char), length, stdin);
a[length]='\0';
char* name=analyze(a,"name");
char* langitude=analyze(a,"langitude");
char* latitude=analyze(a,"latitude");
char* altitude="0";
char* speed="0";
char* time=name;
int res=sqliteDB_open();
puts(name);puts(langitude);puts(latitude);puts(altitude);puts(speed);puts(time);
printf("%d",res);
res=sqliteDB_opt_addpath(name,langitude,latitude,altitude,speed,time,"1");
//printf("%d",res);
sqliteDB_close();
return 0;
}
return 0;
}
Binary file added cgi-bin/addpoint.cgi
Binary file not shown.
30 changes: 30 additions & 0 deletions cgi-bin/addpoint.c~
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"tools.h"
#include"/arm2410cl/Trolltech/qt-embedded-4.4.0/myqt/YJSQLite.h"
#define DEBUG 0
int main(){
printf("Content-type: text/html\n\n");
char* type=getenv("CONTENT_TYPE");
int length=atoi(getenv("CONTENT_LENGTH"));
if(strcmp(type,"application/x-www-form-urlencoded")==0){
char *a=(char*)malloc(sizeof(char)*100);
fread(a, sizeof(char), length, stdin);
a[length]='\0';
char* name=analyze(a,"name");
char* langitude=analyze(a,"langitude");
char* latitude=analyze(a,"latitude");
char* altitude="0";
char* speed="0";
char* time=name;
int res=sqliteDB_open();
puts(name);puts(langitude);puts(latitude);puts(altitude);puts(speed);puts(time);
printf("%d",res);
res=sqliteDB_opt_addpath(name,langitude,latitude,altitude,speed,time);
//printf("%d",res);
sqliteDB_close();
return 0;
}
return 0;
}
21 changes: 21 additions & 0 deletions cgi-bin/delpoint.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"tools.h"
#include"/arm2410cl/Trolltech/qt-embedded-4.4.0/myqt/YJSQLite.h"
#define DEBUG 1
int main(){
char* type=getenv("CONTENT_TYPE");
int length=atoi(getenv("CONTENT_LENGTH"));
if(strcmp(type,"application/x-www-form-urlencoded")==0){
char a[100];
fread(a, sizeof(char), length, stdin);
a[length]='\0';
char* name=analyze(a,"name");
sqliteDB_open();
sqliteDB_opt_deletepath(name);
sqliteDB_close();
return 0;
}
return 0;
}
Binary file added cgi-bin/delpoint.cgi
Binary file not shown.
21 changes: 21 additions & 0 deletions cgi-bin/delpoint.c~
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"tools.h"
#include"/arm2410cl/Trolltech/qt-embedded-4.4.0/myqt/YJSQLite.h"
#define DEBUG 1
int main(){
char* type=getenv("CONTENT_TYPE");
int length=atoi(getenv("CONTENT_LENGTH"));
if(strcmp(type,"application/x-www-form-urlencoded")==0){
char a[100];
fread(a, sizeof(char), length, stdin);
a[length]='\0';
char* name=analyze(a,"name");
sqliteDB_open();
sqliteDB_opt_delete_path(name);
sqliteDB_close();
return 0;
}
return 0;
}
56 changes: 56 additions & 0 deletions cgi-bin/getpointlist.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include<stdio.h>
#include<stdlib.h>
#include"tools.h"
#include<string.h>
#include"/arm2410cl/Trolltech/qt-embedded-4.4.0/myqt/YJSQLite.h"
#define DEBUG 0
void data_to_str(char *data_str){
int tip;
int i;
for(i=0;i<strlen(data_str);i++){
if(data_str[i]=='.'){
tip=i;
break;
}
}
tip-=2;
double data=0,m=0;
for(i=0;i<tip;i++){
data*=10;
data+=data_str[i]-'0';
}
for(i=tip;i<tip+2;i++){
m*=10;
m+=data_str[i]-'0';
}

int tmp=10;
for(i=tip+1;i<tip+7;i++){
m+=(data_str[i]-'0')/tmp;
tmp*=10;
}
data+=m/60.0;

///122.09395837,37.52878708
//12204.671390,3731.523980
memset(data_str,'\0',sizeof(char)*50);
sprintf(data_str,"%.3f",data);
}
int main(){
puts("Content-type: text/plain\n\n");
char *data=getenv("QUERY_STRING");
char* operate=analyze(data,"operate");
if(strcmp(operate,"getpointlist")==0){
char* res;
int test=sqliteDB_open();
res=sqliteDB_opt_select_allpath();
sqliteDB_close();
if(DEBUG){
res="哈尔滨工业大学(威海)#122.067#37.517#0#0#0#1#123.067#38.517#0#0#P1#2#123.067#36.517#0#0#P2#3#121.067#36.517#0#0#P3#4#121.067#38.517#0#0#P4";
}
puts(res);
}
else{
printf("error");
}
}
Binary file added cgi-bin/getpointlist.cgi
Binary file not shown.
24 changes: 24 additions & 0 deletions cgi-bin/getpointlist.c~
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include<stdio.h>
#include<stdlib.h>
#include"tools.h"
#include<string.h>
#include"/arm2410cl/Trolltech/qt-embedded-4.4.0/myqt/YJSQLite.h"
#define DEBUG 0
int main(){
puts("Content-type: text/plain\n\n");
char *data=getenv("QUERY_STRING");
char* operate=analyze(data,"operate");
if(strcmp(operate,"getpointlist")==0){
char* res;
int test=sqliteDB_open();
res=sqliteDB_opt_select_allpath();
sqliteDB_close();
if(DEBUG){
res="哈尔滨工业大学(威海)#122.067#37.517#0#0#0#1#123.067#38.517#0#0#P1#2#123.067#36.517#0#0#P2#3#121.067#36.517#0#0#P3#4#121.067#38.517#0#0#P4";
}
puts(res);
}
else{
printf("error");
}
}
11 changes: 11 additions & 0 deletions cgi-bin/hello.c~
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include
void main(){
printf("Content-type: text/html\n\n");
printf("\n");
printf("\n");
printf("\n");
printf("Hello, world.\n");
printf("\n");
printf("\n");
exit(0);
}
36 changes: 36 additions & 0 deletions cgi-bin/leds.cgi~
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh

type=0
period=1

case $QUERY_STRING in
*ping*)
type=0
;;
*counter*)
type=1
;;
*stop*)
type=2
;;
esac

case $QUERY_STRING in
*slow*)
period=0.25
;;
*normal*)
period=0.125
;;
*fast*)
period=0.0625
;;
esac

/bin/echo $type $period > /tmp/led-control

echo "Content-type: text/html; charset=gb2312"
echo
/bin/cat led-result.template

exit 0
27 changes: 27 additions & 0 deletions cgi-bin/login.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"tools.h"
#include"/arm2410cl/Trolltech/qt-embedded-4.4.0/myqt/YJSQLite.h"
#define DEBUG 0
int main(){
printf("Content-type: text/html\n\n");
char *data=getenv("QUERY_STRING");
char* username=analyze(data,"username");
char* password=analyze(data,"password");
char* a;
sqliteDB_open();
a=Login(username,password);
sqliteDB_close();
if(DEBUG){
//a=1;
}
puts(a);
if(strcmp(a,"successed")==0){
printf("<script>window.location.replace(\"/map.html\")</script>\n");
}
else{
printf("error");
}
return 0;
}
Binary file added cgi-bin/login.cgi
Binary file not shown.
27 changes: 27 additions & 0 deletions cgi-bin/login.c~
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"tools.h"
//#include"/arm2410cl/Trolltech/qt-embedded-4.4.0/myqt/YJSQLite.h"
#define DEBUG 0
int main(){
printf("Content-type: text/html\n\n");
char *data=getenv("QUERY_STRING");
char* username=analyze(data,"username");
char* password=analyze(data,"password");
char* a;
// sqliteDB_open();
//a=Login(username,password);
//sqliteDB_close();
if(DEBUG){
//a=1;
}
puts(a);
if(strcmp(a,"successed")==0){
printf("<script>window.location.replace(\"/map.html\")</script>\n");
}
else{
printf("error");
}
return 0;
}
5 changes: 5 additions & 0 deletions cgi-bin/make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
arm-linux-gcc -o login.cgi login.c -L /arm2410cl/Trolltech/qt-embedded-4.4.0/lib -lsqlite3
arm-linux-gcc -o addpoint.cgi addpoint.c -L /arm2410cl/Trolltech/qt-embedded-4.4.0/lib -lsqlite3
arm-linux-gcc -o delpoint.cgi delpoint.c -L /arm2410cl/Trolltech/qt-embedded-4.4.0/lib -lsqlite3
arm-linux-gcc -o refreshpos.cgi refreshpos.c -L /arm2410cl/Trolltech/qt-embedded-4.4.0/lib -lsqlite3
arm-linux-gcc -o getpointlist.cgi getpointlist.c -L /arm2410cl/Trolltech/qt-embedded-4.4.0/lib -lsqlite3
Loading

0 comments on commit e1e4d9a

Please sign in to comment.