Commit 0fa8f5e2 authored by Sarvin Taba's avatar Sarvin Taba

api zip file added

parent b5b455db
File added
import React, { useState } from "react"; import React, { useState } from "react";
import Axios from "axios";
const GeneralStatus = () => { const GeneralStatus = () => {
const [newDatasetBtn, setNewDatasetBtn] = useState(true); const [newDatasetBtn, setNewDatasetBtn] = useState(true);
const [captueBtn, setCaptureBtn] = useState("Start Capture"); const [captueBtn, setCaptureBtn] = useState("Start Capture");
const [gpsBtn, setGpsBtn] = useState("Start Gps"); const [gpsBtn, setGpsBtn] = useState("Start Gps");
const [imuBtn, setImuBtn] = useState("Start Imu"); const [imuBtn, setImuBtn] = useState("Start Imu");
const [datasetName, setDatasetName] = useState("dataset 1");
const onNewDataSet = () => { const onNewDataSet = () => {
Axios({
method: "GET",
withCredentials: true,
url: process.env.REACT_APP_BACKEND_URL + "/dataset/start",
}).then(async (res) => {
console.log("********************");
// update dataset name
setDatasetName(res)
});
setNewDatasetBtn(false); setNewDatasetBtn(false);
}; };
const onCaptureBtnClick = () => { const onCaptureBtnClick = () => {
Axios({
method: "GET",
withCredentials: true,
url: process.env.REACT_APP_BACKEND_URL + "/camera/start",
}).then(async (res) => {
console.log("********************");
});
if (captueBtn === "Start Capture") { if (captueBtn === "Start Capture") {
setCaptureBtn("End Capture"); setCaptureBtn("End Capture");
} }
...@@ -20,6 +41,14 @@ const GeneralStatus = () => { ...@@ -20,6 +41,14 @@ const GeneralStatus = () => {
}; };
const onGpsBtnClick = () => { const onGpsBtnClick = () => {
Axios({
method: "GET",
withCredentials: true,
url: process.env.REACT_APP_BACKEND_URL + "/gps/start",
}).then(async (res) => {
console.log("********************");
});
if (gpsBtn === "Start Gps"){ if (gpsBtn === "Start Gps"){
setGpsBtn("End Gps"); setGpsBtn("End Gps");
} }
...@@ -30,6 +59,14 @@ const GeneralStatus = () => { ...@@ -30,6 +59,14 @@ const GeneralStatus = () => {
const onImuBtnClick = () => { const onImuBtnClick = () => {
Axios({
method: "GET",
withCredentials: true,
url: process.env.REACT_APP_BACKEND_URL + "/imu/start",
}).then(async (res) => {
console.log("********************");
});
if (imuBtn === "Start Imu") if (imuBtn === "Start Imu")
{ {
setImuBtn("End Imu"); setImuBtn("End Imu");
...@@ -49,10 +86,10 @@ const GeneralStatus = () => { ...@@ -49,10 +86,10 @@ const GeneralStatus = () => {
className="btn btn-primary btn-block" className="btn btn-primary btn-block"
onClick={onNewDataSet} onClick={onNewDataSet}
> >
New Dataset a New Dataset
</button> </button>
</div> </div>
<div className="col-6 px-1 my-1">DataSetName</div> <div className="col-6 px-1 my-1">{datasetName}</div>
<div className="col-6 px-1 my-1"> <div className="col-6 px-1 my-1">
<button <button
className="btn btn-primary btn-block" className="btn btn-primary btn-block"
......
import Axios from "axios"; import Axios from "axios";
import { useEffect, useState } from "react"; import { useState } from "react";
const lockDic =[{key : 1 , value : "value1"}, {key: 2 , value: "value2"}]; const lockDic =[{key : 1 , value : "value1"}, {key: 2 , value: "value2"}];
const Gps = ({socket}) => { const Gps = ({socket}) => {
...@@ -11,21 +11,9 @@ const Gps = ({socket}) => { ...@@ -11,21 +11,9 @@ const Gps = ({socket}) => {
setGpsData(res); setGpsData(res);
}) })
// useEffect(() => {
// Axios({
// method: "GET",
// withCredentials: true,
// url: process.env.REACT_APP_BACKEND_URL + "/gpsInfo",
// }).then(async (res) => {
// console.log("********************");
// setGpsData(res.data);
// console.log(res.data);
// // console.log(lockDic.find((x)=> x.key === gpsData.lock ).value)
// });
// }, [newGpsData]);
return ( return (
<div className={"border p-1 rounded pb-3 border-thicker " + (gpsData.connection ? "border-success " : "border-danger") }> <div className={"border border-2 p-1 rounded pb-3 " + (gpsData.connection ? "border-success " : "border-danger") } >
<h6>GPS</h6> <h6>GPS</h6>
<div> <div>
<div className="col-6 float-left text-right bold">Status :</div> <div className="col-6 float-left text-right bold">Status :</div>
......
...@@ -23,7 +23,7 @@ const Imu = ({socket}) => { ...@@ -23,7 +23,7 @@ const Imu = ({socket}) => {
// }, [newImuData]); // }, [newImuData]);
return ( return (
<div className={"border p-1 rounded pb-3 border-thicker " + (imuData.connection ? "border-success " : "border-danger") }> <div className={"border p-1 rounded pb-3 border-2 " + (imuData.connection ? "border-success " : "border-danger") }>
<h6>IMU</h6> <h6>IMU</h6>
<div> <div>
<div className="col-4 float-left text-right bold">X :</div> <div className="col-4 float-left text-right bold">X :</div>
......
...@@ -15,9 +15,3 @@ code { ...@@ -15,9 +15,3 @@ code {
font-weight: bold; font-weight: bold;
} }
.border{ overflow: auto !important;} .border{ overflow: auto !important;}
.border-thick {
border-width: 2px !important;
}
.border-thicker {
border-width: 3px !important;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment