-
Notifications
You must be signed in to change notification settings - Fork 0
/
SendEmail.cs
104 lines (70 loc) · 2.17 KB
/
SendEmail.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
public class SendEmail : MonoBehaviour {
[SerializeField]
Text TextCounter;
List<TrackData> mTracks;
public bool bCaptureData = false;
private int icounter;
public void ResetRecording(){
bCaptureData = false;
TextCounter.text = "record";
mTracks = new List<TrackData> ();
icounter = 1;
}
public void StartRecording(){
if (bCaptureData == false) {
//start recording
bCaptureData = true;
} else {
//stop
bCaptureData = false;
SendEmailMessage ();
ResetRecording ();
}
}
public void AddDataTrack(string newString, string newStringA){
string sTemp;
float sumSpeed = 0;
float muSpeed = 0;//mean speed = sum of all speeds / number of cars, i.e. icounter
float sumAngle = 0;
float muAngle = 0;
if (bCaptureData == false) {
return;
}
TextCounter.text = icounter.ToString();
if (newString != "0") {
sumSpeed = sumSpeed + float.Parse (newString);
muSpeed = sumSpeed / icounter;
sumAngle = sumAngle + float.Parse (newStringA);
muAngle = sumAngle / icounter;
sTemp = "\n" + "Frame #: " + icounter + ", dTime (sec): " + Time.deltaTime + ", Instanteneous Velocity: " + newString + ", Mean Speed (current): " + muSpeed + ", Angular Orientation of Motion: " + newStringA + ", Mean Angle (current): " + muAngle;
icounter++;
mTracks.Add(new TrackData(sTemp));
}
}
public void SendEmailMessage ()
{
string email = "";
string subject = MyEscapeURL("EBs tracking data " + System.DateTime.UtcNow.ToString("HH:mm dd MMMM, yyyy")); // add mean and std
//LOOP THROUGH DATA CLASS
//string body = MyEscapeURL(csvCaptureobj.CSVFile);
string body = "";
foreach (TrackData mData in mTracks)
{
body = body + mData.GetDataForObj ();
// do something with this group!
}
body = MyEscapeURL (body);
Application.OpenURL ("mailto:" + email + "?subject=" + subject + "&body=" + body);
Debug.Log ("mailto:" + email + "?subject=" + subject + "&body=" + body);
ResetRecording();
}
string MyEscapeURL (string url)
{
return WWW.EscapeURL(url).Replace("+","%20");
}
}