Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/backendapi/apiStageCenterCalibrationGetStatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// src/backendapi/apiStageCenterCalibrationGetStatus.js
import createAxiosInstance from "./createAxiosInstance";

const apiStageCenterCalibrationGetStatus = async () => {
try {
const axiosInstance = createAxiosInstance();

// Send GET request to check calibration status
const response = await axiosInstance.get("/StageCenterCalibrationController/getIsCalibrationRunning");

return response.data; // Return the data from the response
} catch (error) {
console.error("Error getting stage center calibration status:", error);
throw error; // Throw error to be handled by the caller
}
};

export default apiStageCenterCalibrationGetStatus;

/*
Example:
apiStageCenterCalibrationGetStatus()
.then(isRunning => {
console.log("Calibration running:", isRunning);
})
.catch(error => {
console.error("Error:", error);
});
*/
60 changes: 60 additions & 0 deletions src/backendapi/apiStageCenterCalibrationPerformCalibration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// src/backendapi/apiStageCenterCalibrationPerformCalibration.js
import createAxiosInstance from "./createAxiosInstance";

const apiStageCenterCalibrationPerformCalibration = async ({
start_x = 0,
start_y = 0,
exposure_time_us = 3000,
speed = 5000,
step_um = 50.0,
max_radius_um = 2000.0,
brightness_factor = 1.4,
}) => {
try {
const axiosInstance = createAxiosInstance();

// Build the query string dynamically
let url = "/StageCenterCalibrationController/performCalibration?";
const queryParams = [];

queryParams.push(`start_x=${encodeURIComponent(start_x)}`);
queryParams.push(`start_y=${encodeURIComponent(start_y)}`);
queryParams.push(`exposure_time_us=${encodeURIComponent(exposure_time_us)}`);
queryParams.push(`speed=${encodeURIComponent(speed)}`);
queryParams.push(`step_um=${encodeURIComponent(step_um)}`);
queryParams.push(`max_radius_um=${encodeURIComponent(max_radius_um)}`);
queryParams.push(`brightness_factor=${encodeURIComponent(brightness_factor)}`);

// Join all query parameters with '&'
url += queryParams.join("&");

// Send GET request with the constructed URL
const response = await axiosInstance.get(url);

return response.data; // Return the data from the response
} catch (error) {
console.error("Error performing stage center calibration:", error);
throw error; // Throw error to be handled by the caller
}
};

export default apiStageCenterCalibrationPerformCalibration;

/*
Example:
apiStageCenterCalibrationPerformCalibration({
start_x: 0,
start_y: 0,
exposure_time_us: 3000,
speed: 5000,
step_um: 50.0,
max_radius_um: 2000.0,
brightness_factor: 1.4
})
.then(positions => {
console.log("Calibration positions:", positions);
})
.catch(error => {
console.error("Error:", error);
});
*/
29 changes: 29 additions & 0 deletions src/backendapi/apiStageCenterCalibrationStopCalibration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// src/backendapi/apiStageCenterCalibrationStopCalibration.js
import createAxiosInstance from "./createAxiosInstance";

const apiStageCenterCalibrationStopCalibration = async () => {
try {
const axiosInstance = createAxiosInstance();

// Send GET request to stop calibration
const response = await axiosInstance.get("/StageCenterCalibrationController/stopCalibration");

return response.data; // Return the data from the response
} catch (error) {
console.error("Error stopping stage center calibration:", error);
throw error; // Throw error to be handled by the caller
}
};

export default apiStageCenterCalibrationStopCalibration;

/*
Example:
apiStageCenterCalibrationStopCalibration()
.then(result => {
console.log("Calibration stopped:", result);
})
.catch(error => {
console.error("Error:", error);
});
*/
Loading