- Bingrui Feng (rheafeng)
- Huijing Liang (MollyLiang)
- Jiayan Wang (jywang0)
- Meng-Ze Chen (meng-ze)
- Xinkai Wang (w546296781)
- Yu-Ting Tsao (vin20777)
Provide a data layer library for the other team to use.
Currently, NINE APIs are provided for accessing database (mocking data for now). Please see inside the documentation folder for more detail.
Step 1: Create Database Manager Instance.
private DataBaseManager dbm;
dbm = new DataBaseManager();
dbm.ConnectToDB("Rover.db");
Step 2: Use your desired APIs below.
public int SetSensorMatrixById(int timestamp, int sensorId, int[,] matrix)
For example:
int[,] matrix = new int[4, 4] {
{ 1, 1, 1, 1 },
{ 1, 0, 0, 1 },
{ 1, 0, 0, 1 },
{ 1, 1, 1, 1 }
};
int resultCode = dbm.SetSensorMatrixById(20200420, 2, matrix);
public int[,] GetSensorMatrixById(int sensorId, int timestamp)
For example:
int[,] matrix = dbm.GetSensorMatrixById(2, 20200420);
public int CreateExploredMaze(int mazeId, int[,] exploredMaze)
For example:
int mazeId = 3;
int[,] exploredMaze = new int[4, 4] {
{ 1, 1, -1, -1 },
{ 1, 0, 0, -1 },
{ 1, 0, 0, 1 },
{ 1, 1, 1, 1 }
};
int resultCode = dbm.CreateExploredMaze(mazeId, exploredMaze);
public string[][] GetMazeById(int mazeId)
For example:
int mazeId = 3;
int[,] storedMaze = dbm.GetMazeById(mazeId);
public int UpdateMaze(int[,] updatedMaze)
For example:
int mazeId = 3;
int[,] updatedMaze = new int[4, 4] {
{ 1, 1, 1, 1 },
{ 1, 0, 0, 1 },
{ 1, 0, 0, 1 },
{ 1, 1, 1, 1 }
};
int resultCode = dbm.UpdateMaze(mazeId, updatedMaze);
public int UpdateCoverage(float mazeCoverage)
For example:
float mazeCoverage = 0.4F;
int resultCode = dbm.UpdateCoverage(mazeCoverage);
public int UpdateTimeTaken(int second)
For example:
int second = 101;
int resultCode = dbm.UpdateTimeTaken(second);
public int UpdateMoveHistory(String[] path)
For example:
String[] path = new String[5] { "East", "East", "North", "East", "South" };
int resultCode = dbm.UpdateMoveHistory(path);
public int UpdatePoints(int points)
For example:
int points = 999;
int resultCode = dbm.UpdatePoints(points);
Please download the demo project to see how to call and use our dll. Also, the dll is generated from DatabaseProviderClass.cs file which provides source code.