• 沒有找到結果。

跑跑王

N/A
N/A
Protected

Academic year: 2021

Share "跑跑王"

Copied!
28
0
0

加載中.... (立即查看全文)

全文

(1)

國 立 台 灣 科 技 大 學 電 機 工 程 系

102 學 年 度 實 務 專 題 技 術 報 告

專題名稱:跑跑王 專題編號:TR-102-EE-C04

研究組員

四電四甲 B9907006 蔡奕甫 四電四甲 B9907011 賴皓鋒

組別: C04 班別: 甲

指導老師: 黃騰毅 教授

(2)

一、 研究動機 ... 3

二、 系統開發軟硬體 ... 3

1. 硬體 ... 3

2. 軟體 ... 4

三、 系統架構圖 ... 5

四、 操作流程圖 ... 6

五、 實作內容 ... 8

1. 登入介面 ... 8

2. 上傳座標 ... 8

3. 歷史查詢 ... 9

4. 熱門路線查詢 ... 10

六、 參數表 ... 11

1. Account ... 11

2. Register ... 11

3. Location ... 12

4. Googlemap ... 12

5. Table ... 12

七、 ios 程式碼 ... 13

1. ViewController.h ... 13

2. ViewController.m ... 14

3. newaccountViewController.h ... 17

4. newaccountViewController.m ... 18

5. forgetpasswordViewController.h ... 20

6. forgetpasswordViewController.m ... 21

7. EditorViewController.h ... 22

8. EditorViewController.m ... 23

9. secondViewController.h ... 25

10. secondViewController.m ... 26

八、 電腦網頁平台 ... 28

九、 未來展望 ... 28

(3)

一、 研究動機

現今社會,智慧型手機普及,帶給人們無限的便利生活,但也衍 生出許多的問題,如:低頭族的出現,大家沉溺於網路的世界,鮮少 從事戶外活動。因此,我們希望能透過智慧型手機與雲端的結合,讓 熱愛跑步的族群,利用網路社群平台相互分享,並提供遊戲介面,增 加跑步趣味性,提高運動意願,以提升國人健康。

二、 系統開發軟硬體 1. 硬體

(1). iphone 手機或平板

a. 內建 3G 無線網路傳輸 b. GPS 定位系統

(2). MAC 系列電腦 a. 安裝 Xcode

(3). QNAP TS-269pro 網路伺服器

TS-269pro 搭載全新 QTS4.0 作業系統,為一功能強大的網路儲 存設備,能完成資料備份、檔案同步、遠端存取等任務,只要連上網 際網路,都能馬上連結到 TS-269pro 存取檔案,本次專題即是以此為 資料儲存空間,佔有重要地位。

硬體規格

處理器 Intel® Atom™ 2.13GHz Dual-core Processor 記憶體 1GB RAM

快閃記憶體 512MB DOM

網路埠 2 x Gigabit RJ-45 網路埠 耗電量 休眠模式: 16W 


(4)

2. 軟體

(1). Xcode 5.0 版

Xcode 是種 IDE(integrated development environment),亦即整合是 開發環境,IDE 能管理應用程式資源,並讓你編輯程式碼與使用者介 面,好將不同部分組合起來。

(2). Object-C

Mas OS X 與 iOS 擁有共同的開發環境,也有共同的開發語言:

Object-c,Object-c 提供了在 APPLE 平台上,建立應用程式所需之語 法語結構。

Object-c 是由 C 語言擴充而來,他在原本的 C 語言中添加許多額 外功能,其中最重要的就屬「物件導向程式設計」(object-oriented programming,OOP)。

(3). Filezilla

免費 FTP 用戶端軟體,簡單直覺的介面,有著多線程傳輸、續 傳等功能,是 FTP 上下傳必備的好工具,支援 FTPS/SFTP 傳輸協定、

IPv6 通訊協定、拖放功能,可傳輸及續傳超過 4GB 以上的檔案。

(4). MySQL

MySQL 是一種資料庫管理系統,其使用 C、C++編寫,由於效 能高、成本低、可靠性好,已成為最流行的開發資料源,這次的專題 也是利用 TS-269pro 內的 MySQL 資料庫,做使用者帳號、路線規劃、

經緯座標的雲端記錄及儲存。

(5). PHP

PHP 是一種開放的原始碼,尤其適用於 HTML 的網路開發,一 般來說 PHP 多在網頁伺服器上執行,透過執行 PHP 程式碼來產生網 頁提供瀏覽器讀取,經常與作業系統或資料庫結合,本次專題則與

(5)

三、 系統架構圖

(6)

四、 操作流程圖

(7)
(8)

五、 實作內容 1. 登入介面

基本登入頁面,初次使用 需註冊帳號。

假設密碼為 1234,上圖可 知密碼錯誤,則登入失敗。

假設帳號未註冊,亦即帳 號輸入錯誤,登入失敗。

2. 上傳座標

成功登入後,跳轉至此頁面,可 以觀看目前座標相關資訊。

 右下角 upload 可以單次上傳 座標點至雲端資料庫。

 下方選擇開關為持續自動上 傳。

(9)

3. 歷史查詢

除上傳座標外,另可查詢歷史紀 錄,紀錄方式為:

使用者名稱+跑步日期

後方「R1、R4」為比對資料庫熱 門路線,符合熱門路線第 1 條及 第 4 條。

點入上方超連結,將連入地圖並 繪製當次行跡路線。

(10)

4. 熱門路線查詢

熱門路線查詢,由「Y/N」可以 得知該路線是否完成,以及完成 次數。

按下超連結,可以觀看熱門路線 圖。

(11)

六、 參數表 1. Account

write

參數:sn、rname、pv

patatoto.com/version1/account/write?

sn=tsai20130524&rname=ntust&pv=0

read 參數:無

patatoto.com/version1/account/read

delete 參數:Name

patatoto.com/version1/account/delete?Name=tsai

2. Register

Cel_login

參數:email、password

patatoto.com/version1/register/Cel_login?email=asd@yahoo&passw ord=123456

Cel_ok 參數:email

patatoto.com/version1/register/Cel_ok?email=tsai@yahoo

PC_lgform 參數:無

patatoto.com/version1/register/lgform

PC_login 參數:無

patatoto.com/version1/register/PC_login

PC_ok 參數:無

http://patatoto.com/version1/register/PC_ok

logout 參數:無

patatoto.com/version1/logout

writeE

參數:username、password、account

patatoto.com/version1/register/writeE?username=tsai&password=12 6&account=abc@yahoo

confirm

參數:account、captcha

patatoto.com/version1/register/confirm?account=adads@yahoo.com .tw&captcha=126512156

forget 參數:email

patatoto.com/version1/register/forget?email=tsai@yahoo

(12)

3. Location

write

參數:sn、L1、L2

patatoto.com/version1/location/write?sn=tsai20130524&L1=123&L2=

456

read 參數:sn

patatoto.com/version1/location/read?sn=tsai20130524

delete 參數:sn

patatoto.com/version1/location/delete?sn=tsai20130524

checkRD 參數:sn

patatoto.com/version1/location/checkRD?sn=111

analyze 參數:sn

patatoto.com/version1/location/analyze?sn=111

4. Googlemap readmap 參數:sn

patatoto.com/version1/googlemap/readmap?sn=tsai20130524

RDmap 參數:route

patatoto.com/version1/googlemap/RDmap?route=r1

5. Table

write

參數:num、name、sn

patatoto.com/version/table/write?num=1&name=NTUST2Kungkuan&

sn=kg201309181111

public 參數:無

patatoto.com/version1/table/public

read 參數:route

patatoto.com/version1/table/read?route=r1

Cel_hot 參數:無

patatoto.com/version1/table/Cel_hot

PC_hot 參數:無

patatoto.com/version1/table/PC_hot

delete 參數:route

patatoto.com/version1/table/delete?route=r1

(13)

七、 ios 程式碼 1. ViewController.h

#import <UIKit/UIKit.h>

NSString *_arg;

NSString *_aemail;

NSString *_aname;

@interface ViewController : UIViewController

@property (weak, nonatomic) IBOutlet UITextField *email;

@property (weak, nonatomic) IBOutlet UITextField *ID;

@property (weak, nonatomic) IBOutlet UITextField *password;

@property (weak, nonatomic) IBOutlet UILabel *output;

@property (weak, nonatomic) IBOutlet UIWebView * weblook3;

//@property (retain, nonatomic) IBOutlet UITextView *resultsView2;

- (IBAction)done:(id)sender;

- (IBAction)preview:(UIStoryboardSegue *)sender;

- (IBAction)createID:(id)sender;

- (IBAction)hideKeyboard:(id)sender;

@end

(14)

2. ViewController.m

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController - (void)viewDidLoad

{

[super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

}

- (void)viewDidAppear:(BOOL)animated {

[super viewDidAppear:animated];

// self.ID.text = _arg;

}

- (void)viewWillDisappear:(BOOL)animated

{ //此事件會發生在 View 要開始轉換時

[super viewWillDisappear:animated];

_arg = self.ID.text;

_aemail = self.ID.text;

}

- (IBAction)exitToHere:(UIStoryboardSegue *)sender { // Execute this code upon unwinding.

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

(15)

- (IBAction)preview:(id)sender { NSString* ac = self.ID.text;

NSString* pw = self.password.text;

//NSURLRequest* test2;

NSString* urlString =[[NSString alloc]

initWithFormat:@"http://219.68.108.62/version1/register/Cel_login?email=%@&pass word=%@", ac, pw];

//[self dismissViewControllerAnimated:YES completion:nil];

NSURL* webURL = [[NSURL alloc] initWithString:urlString];

[self.weblook3 loadRequest:[NSURLRequest requestWithURL: webURL]];

NSURL *url = [NSURL URLWithString:urlString];

NSURLRequest *request = [NSURLRequest requestWithURL: url];

NSHTTPURLResponse *response;

NSData *responseData = [NSURLConnection sendSynchronousRequest:

request returningResponse: &response error: nil];

NSString *result = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];

NSLog(@"ABCDDDDD:%@",result);

self.output.text = result;

if ([self.output.text isEqual: @"1"]) {

[self performSegueWithIdentifier:@"wait" sender:self];

} }

-(IBAction)createID:(id)sender{

NSString* id1 = self.ID.text;

NSString* pw1 = self.password.text;

(16)

NSURL* webURL=[[NSURL alloc] initWithString:urlString];

[self.weblook3 loadRequest:[NSURLRequest requestWithURL:webURL]];

NSURL *url = [NSURL URLWithString:urlString];

NSURLRequest *request = [NSURLRequest requestWithURL: url];

NSHTTPURLResponse *response;

NSData *responseData = [NSURLConnection sendSynchronousRequest:

request returningResponse: &response error: nil];

NSString *result = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];

NSLog(@"ABCDDDDD:%@",result);

self.output.text = result;

} -

(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrie ntation

{

return (interfaceOrientation == UIInterfaceOrientationPortrait);

}

- (IBAction)done:(id)sender {

// [self performSegueWithIdentifier:@"wait" sender:self];

}

- (IBAction)hideKeyboard:(id)sender{

[self.ID resignFirstResponder];

[self.password resignFirstResponder];

}

@end

(17)

3. newaccountViewController.h

#import <UIKit/UIKit.h>

@interface newaccountViewController : UIViewController

@property (weak, nonatomic) IBOutlet UITextField *email;

@property (weak, nonatomic) IBOutlet UITextField *account;

@property (weak, nonatomic) IBOutlet UITextField *password;

@property (weak, nonatomic) IBOutlet UILabel *output;

@property (weak, nonatomic) IBOutlet UIWebView * weblook3;

- (IBAction)createID:(id)sender;

- (IBAction)hideKeyboard:(id)sender;

@end

(18)

4. newaccountViewController.m

#import "newaccountViewController.h"

@interface newaccountViewController ()

@end

@implementation newaccountViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {

self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

if (self) {

// Custom initialization }

return self;

}

- (void)viewDidLoad {

[super viewDidLoad];

// Do any additional setup after loading the view.

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

-(IBAction)createID:(id)sender{

NSString* id1 = self.email.text;

NSString* pw1 = self.password.text;

NSString* ac1 = self.account.text;

(19)

NSString* urlString =[[NSString alloc]

initWithFormat:@"http://patatoto.com/version1/register/writeE?username=%@&pass word=%@&account=%@",ac1,pw1,id1];

NSURL* webURL=[[NSURL alloc] initWithString:urlString];

[self.weblook3 loadRequest:[NSURLRequest requestWithURL:webURL]];

NSURL *url = [NSURL URLWithString:urlString];

NSURLRequest *request = [NSURLRequest requestWithURL: url];

NSHTTPURLResponse *response;

NSData *responseData = [NSURLConnection sendSynchronousRequest:

request returningResponse: &response error: nil];

NSString *result = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];

NSLog(@"ABCDDDDD:%@",result);

self.output.text = result;

}

- (IBAction)hideKeyboard:(id)sender{

[self.account resignFirstResponder];

[self.email resignFirstResponder];

[self.password resignFirstResponder];

}

@end

(20)

5. forgetpasswordViewController.h

#import <UIKit/UIKit.h>

@interface forgetpasswordViewController : UIViewController

@property (weak, nonatomic) IBOutlet UITextField *email;

@property (weak, nonatomic) IBOutlet UILabel *output;

@property (weak, nonatomic) IBOutlet UILabel *output2;

@property (weak, nonatomic) IBOutlet UIWebView * weblook3;

- (IBAction)done:(id)sender;

- (IBAction)hideKeyboard:(id)sender;

@end

(21)

6. forgetpasswordViewController.m

#import "forgetpasswordViewController.h"

@interface forgetpasswordViewController ()

@end

@implementation forgetpasswordViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {

self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

if (self) {

// Custom initialization }

return self;

}

- (void)viewDidLoad {

[super viewDidLoad];

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

-(IBAction)done:(id)sender{

NSString* urlString =[[NSString alloc]

initWithFormat:@"http://patatoto.com/version1/register/forget?email=%@",self.email.t ext];

NSURL * webURL=[[NSURL alloc] initWithString:urlString];

[self.weblook3 loadRequest:[NSURLRequest requestWithURL:webURL]];

}

(22)

7. EditorViewController.h

#import <UIKit/UIKit.h>

#import "ViewController.h"

NSString *_arg;

extern NSString *_arg;

NSString *_aname;

extern NSString *_aname;

NSString *_aemail;

extern NSString *_aemail;

@interface EditorViewController : UIViewController

@property (weak, nonatomic) IBOutlet UILabel *name3;

@property (weak, nonatomic) IBOutlet UIWebView * weblook;

- (IBAction)lout:(id)sender;

@end

(23)

8. EditorViewController.m

#import "EditorViewController.h"

@interface EditorViewController ()

@end

@implementation EditorViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {

self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

if (self) {

// Custom initialization }

return self;

}

- (void)viewDidAppear:(BOOL)animated {

[super viewDidAppear:animated];

NSString* email = _arg;

NSString* urlString =[[NSString alloc]

initWithFormat:@"http://patatoto.com/version1/register/Cel_ok?email=%@", email];

//[self dismissViewControllerAnimated:YES completion:nil];

NSURL* webURL = [[NSURL alloc] initWithString:urlString];

[self.weblook loadRequest:[NSURLRequest requestWithURL: webURL]];

NSURL *url = [NSURL URLWithString:urlString];

NSURLRequest *request = [NSURLRequest requestWithURL: url];

NSHTTPURLResponse *response;

(24)

NSString *result = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];

NSLog(@"ABCDDDDD:%@",result);

self.name3.text = result;

_arg = result;

_aname = result;

}

-(IBAction)lout:(id)sender{

_arg = @"";

_aname = @"";

_aemail = @"";

}

- (void)viewDidLoad {

[super viewDidLoad];

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

@end

(25)

9. secondViewController.h

#import <UIKit/UIKit.h>

NSString *_arg;

extern NSString *_arg;

NSString *_aname;

extern NSString *_aname;

NSString *_aemail;

extern NSString *_aemail;

@interface secondViewController : UIViewController

@property (weak, nonatomic) IBOutlet UITextField *ID;

@property (weak, nonatomic) IBOutlet UITextField *sroadname;

@property (weak, nonatomic) IBOutlet UIWebView * weblook21;

- (IBAction)Return:(id)sender;

- (IBAction)Renew:(id)sender;

- (IBAction)hideKeyboard2:(id)sender;

@end

(26)

10. secondViewController.m

#import "secondViewController.h"

@interface secondViewController ()

@end

@implementation secondViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {

self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

if (self) {

// Custom initialization }

return self;

}

- (void)viewDidLoad {

[super viewDidLoad];

}

- (void)viewDidAppear:(BOOL)animated {

[super viewDidAppear:animated];

self.ID.text = _arg;

//NSString* ac = self.ID.text;

NSString* urlString =[[NSString alloc]

initWithFormat:@"http://219.68.108.62/version1/account/read"];

//NSString* urlString =[[NSString alloc]

initWithFormat:@"http://219.68.108.62/version1/account/read?Name=%@&rname=

%@", ac,self.sroadname.text];

//[self dismissViewControllerAnimated:YES completion:nil];

NSURL* webURL = [[NSURL alloc] initWithString:urlString];

(27)

- (IBAction)Renew:(id)sender { //NSString* ac = self.ID.text;

NSString* urlString =[[NSString alloc]

initWithFormat:@"http://219.68.108.62/version1/account/read"];

//NSString* urlString =[[NSString alloc]

initWithFormat:@"http://219.68.108.62/version1/account/read?Name=%@&rname=

%@", ac,self.sroadname.text];

//[self dismissViewControllerAnimated:YES completion:nil];

NSURL* webURL = [[NSURL alloc] initWithString:urlString];

[self.weblook21 loadRequest:[NSURLRequest requestWithURL: webURL]];

}

- (IBAction)Return:(id)sender { //NSString* ac = self.ID.text;

NSString* urlString =[[NSString alloc]

initWithFormat:@"http://219.68.108.62/version1/account/read"];

//NSString* urlString =[[NSString alloc]

initWithFormat:@"http://219.68.108.62/version1/account/read?Name=%@&rname=

%@", ac,self.sroadname.text];

//[self dismissViewControllerAnimated:YES completion:nil];

NSURL* webURL = [[NSURL alloc] initWithString:urlString];

[self.weblook21 loadRequest:[NSURLRequest requestWithURL: webURL]];

}

- (IBAction)hideKeyboard2:(id)sender { [self.ID resignFirstResponder];

[self.sroadname resignFirstResponder];

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

(28)

八、 電腦網頁平台

為了方便使用者運動完回到家後使用,我們另外做了電腦網頁平 台界面,讓使用者可以透過電腦進行個人化路線管理與查詢。

網址: http://patatoto.com/wordpress/

九、 未來展望

為了提升國人的運動欲望,將繼續增加許多全國的熱門慢跑路線,

並做成手機遊戲,並提供社群互動分享,藉由路線的完成度,互相比 較積分競賽,增加遊戲豐富程度。甚至可以與觀光結合,建立熱門觀 光景點路線,路跑同時放鬆身心,藉此為地方觀光宣傳。目前我們的 系統已經可以正常運作,但缺乏美觀包裝,網頁介面尚為文字表現,

未來往網頁設計前進,建立及美化相關網頁,讓使用者也能從電腦查 詢跑步紀錄,並朝上市產品目標繼續努力。

參考文獻

相關文件

Weak solution for problems with shock &amp; rarefaction waves Interface indicator H I takes value zero away from interfacs, yielding standard compressible Euler equations

4 The relationship between the weak Brownian motion of order k, the kth Wiener chaos, kth time-space Wiener chaos, and the.. generalization of the

Wang, Unique continuation for the elasticity sys- tem and a counterexample for second order elliptic systems, Harmonic Analysis, Partial Differential Equations, Complex Analysis,

Establishments engaged in Cleaning Services increased year-on-year; numbers of those engaged in Property Management and Security Services stayed unchanged, whereas

You are a property agent working for the Quality Property Company. A potential client has contacted you from Australia because he will soon be moving to Hong Kong with

For ASTROD-GW arm length of 260 Gm (1.73 AU) the weak-light phase locking requirement is for 100 fW laser light to lock with an onboard laser oscillator. • Weak-light phase

These possibilities are associated with totally di↵erent underlying dynam- ics for electroweak symmetry breaking than the SM, requiring new physics beyond the Higgs around the

(二) 「 I'm the master of my fate, I'm the captain of my soul.」.