[Refactor] Refactor the way import files.
Organize some codes.
This commit is contained in:
28
src-ui/logics/configs/device/useEnableAutoMicSelect.js
Normal file
28
src-ui/logics/configs/device/useEnableAutoMicSelect.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useStore_EnableAutoMicSelect } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useEnableAutoMicSelect = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentEnableAutoMicSelect, updateEnableAutoMicSelect, pendingEnableAutoMicSelect } = useStore_EnableAutoMicSelect();
|
||||
|
||||
const getEnableAutoMicSelect = () => {
|
||||
pendingEnableAutoMicSelect();
|
||||
asyncStdoutToPython("/get/data/auto_mic_select");
|
||||
};
|
||||
|
||||
const toggleEnableAutoMicSelect = () => {
|
||||
pendingEnableAutoMicSelect();
|
||||
if (currentEnableAutoMicSelect.data) {
|
||||
asyncStdoutToPython("/set/disable/auto_mic_select");
|
||||
} else {
|
||||
asyncStdoutToPython("/set/enable/auto_mic_select");
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
currentEnableAutoMicSelect,
|
||||
getEnableAutoMicSelect,
|
||||
updateEnableAutoMicSelect,
|
||||
toggleEnableAutoMicSelect,
|
||||
};
|
||||
};
|
||||
28
src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js
Normal file
28
src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useStore_EnableAutoSpeakerSelect } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useEnableAutoSpeakerSelect = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, pendingEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect();
|
||||
|
||||
const getEnableAutoSpeakerSelect = () => {
|
||||
pendingEnableAutoSpeakerSelect();
|
||||
asyncStdoutToPython("/get/data/auto_speaker_select");
|
||||
};
|
||||
|
||||
const toggleEnableAutoSpeakerSelect = () => {
|
||||
pendingEnableAutoSpeakerSelect();
|
||||
if (currentEnableAutoSpeakerSelect.data) {
|
||||
asyncStdoutToPython("/set/disable/auto_speaker_select");
|
||||
} else {
|
||||
asyncStdoutToPython("/set/enable/auto_speaker_select");
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
currentEnableAutoSpeakerSelect,
|
||||
getEnableAutoSpeakerSelect,
|
||||
updateEnableAutoSpeakerSelect,
|
||||
toggleEnableAutoSpeakerSelect,
|
||||
};
|
||||
};
|
||||
18
src-ui/logics/configs/device/useMicDeviceList.js
Normal file
18
src-ui/logics/configs/device/useMicDeviceList.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useStore_MicDeviceList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useMicDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentMicDeviceList, updateMicDeviceList, pendingMicDeviceList } = useStore_MicDeviceList();
|
||||
|
||||
const getMicDeviceList = () => {
|
||||
pendingMicDeviceList();
|
||||
asyncStdoutToPython("/get/data/mic_device_list");
|
||||
};
|
||||
|
||||
return {
|
||||
currentMicDeviceList,
|
||||
getMicDeviceList,
|
||||
updateMicDeviceList,
|
||||
};
|
||||
};
|
||||
18
src-ui/logics/configs/device/useMicHostList.js
Normal file
18
src-ui/logics/configs/device/useMicHostList.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useStore_MicHostList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useMicHostList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentMicHostList, updateMicHostList, pendingMicHostList } = useStore_MicHostList();
|
||||
|
||||
const getMicHostList = () => {
|
||||
pendingMicHostList();
|
||||
asyncStdoutToPython("/get/data/mic_host_list");
|
||||
};
|
||||
|
||||
return {
|
||||
currentMicHostList,
|
||||
getMicHostList,
|
||||
updateMicHostList,
|
||||
};
|
||||
};
|
||||
42
src-ui/logics/configs/device/useMicThreshold.js
Normal file
42
src-ui/logics/configs/device/useMicThreshold.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import { useStore_MicThreshold, useStore_EnableAutomaticMicThreshold } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useMicThreshold = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold();
|
||||
const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold();
|
||||
|
||||
const getMicThreshold = () => {
|
||||
asyncStdoutToPython("/get/data/mic_threshold");
|
||||
};
|
||||
|
||||
const setMicThreshold = (mic_threshold) => {
|
||||
asyncStdoutToPython("/set/data/mic_threshold", mic_threshold);
|
||||
};
|
||||
|
||||
const getEnableAutomaticMicThreshold = () => {
|
||||
pendingEnableAutomaticMicThreshold();
|
||||
asyncStdoutToPython("/get/data/mic_automatic_threshold");
|
||||
};
|
||||
|
||||
const toggleEnableAutomaticMicThreshold = () => {
|
||||
pendingEnableAutomaticMicThreshold();
|
||||
if (currentEnableAutomaticMicThreshold.data) {
|
||||
asyncStdoutToPython("/set/disable/mic_automatic_threshold");
|
||||
} else {
|
||||
asyncStdoutToPython("/set/enable/mic_automatic_threshold");
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
currentMicThreshold,
|
||||
getMicThreshold,
|
||||
setMicThreshold,
|
||||
updateMicThreshold,
|
||||
|
||||
currentEnableAutomaticMicThreshold,
|
||||
getEnableAutomaticMicThreshold,
|
||||
toggleEnableAutomaticMicThreshold,
|
||||
updateEnableAutomaticMicThreshold,
|
||||
};
|
||||
};
|
||||
24
src-ui/logics/configs/device/useSelectedMicDevice.js
Normal file
24
src-ui/logics/configs/device/useSelectedMicDevice.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { useStore_SelectedMicDevice } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSelectedMicDevice = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSelectedMicDevice, updateSelectedMicDevice, pendingSelectedMicDevice } = useStore_SelectedMicDevice();
|
||||
|
||||
const getSelectedMicDevice = () => {
|
||||
pendingSelectedMicDevice();
|
||||
asyncStdoutToPython("/get/data/selected_mic_device");
|
||||
};
|
||||
|
||||
const setSelectedMicDevice = (selected_mic_device) => {
|
||||
pendingSelectedMicDevice();
|
||||
asyncStdoutToPython("/set/data/selected_mic_device", selected_mic_device);
|
||||
};
|
||||
|
||||
return {
|
||||
currentSelectedMicDevice,
|
||||
getSelectedMicDevice,
|
||||
updateSelectedMicDevice,
|
||||
setSelectedMicDevice,
|
||||
};
|
||||
};
|
||||
24
src-ui/logics/configs/device/useSelectedMicHost.js
Normal file
24
src-ui/logics/configs/device/useSelectedMicHost.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { useStore_SelectedMicHost } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSelectedMicHost = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost();
|
||||
|
||||
const getSelectedMicHost = () => {
|
||||
pendingSelectedMicHost();
|
||||
asyncStdoutToPython("/get/data/selected_mic_host");
|
||||
};
|
||||
|
||||
const setSelectedMicHost = (selected_mic_host) => {
|
||||
pendingSelectedMicHost();
|
||||
asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host);
|
||||
};
|
||||
|
||||
return {
|
||||
currentSelectedMicHost,
|
||||
getSelectedMicHost,
|
||||
updateSelectedMicHost,
|
||||
setSelectedMicHost,
|
||||
};
|
||||
};
|
||||
24
src-ui/logics/configs/device/useSelectedSpeakerDevice.js
Normal file
24
src-ui/logics/configs/device/useSelectedSpeakerDevice.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { useStore_SelectedSpeakerDevice } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSelectedSpeakerDevice = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice, pendingSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice();
|
||||
|
||||
const getSelectedSpeakerDevice = () => {
|
||||
pendingSelectedSpeakerDevice();
|
||||
asyncStdoutToPython("/get/data/selected_speaker_device");
|
||||
};
|
||||
|
||||
const setSelectedSpeakerDevice = (selected_speaker_device) => {
|
||||
pendingSelectedSpeakerDevice();
|
||||
asyncStdoutToPython("/set/data/selected_speaker_device", selected_speaker_device);
|
||||
};
|
||||
|
||||
return {
|
||||
currentSelectedSpeakerDevice,
|
||||
getSelectedSpeakerDevice,
|
||||
updateSelectedSpeakerDevice,
|
||||
setSelectedSpeakerDevice,
|
||||
};
|
||||
};
|
||||
18
src-ui/logics/configs/device/useSpeakerDeviceList.js
Normal file
18
src-ui/logics/configs/device/useSpeakerDeviceList.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useStore_SpeakerDeviceList } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSpeakerDeviceList = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentSpeakerDeviceList, updateSpeakerDeviceList, pendingSpeakerDeviceList } = useStore_SpeakerDeviceList();
|
||||
|
||||
const getSpeakerDeviceList = () => {
|
||||
pendingSpeakerDeviceList();
|
||||
asyncStdoutToPython("/get/data/speaker_device_list");
|
||||
};
|
||||
|
||||
return {
|
||||
currentSpeakerDeviceList,
|
||||
getSpeakerDeviceList,
|
||||
updateSpeakerDeviceList,
|
||||
};
|
||||
};
|
||||
42
src-ui/logics/configs/device/useSpeakerThreshold.js
Normal file
42
src-ui/logics/configs/device/useSpeakerThreshold.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import { useStore_SpeakerThreshold, useStore_EnableAutomaticSpeakerThreshold } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useSpeakerThreshold = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold();
|
||||
const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold();
|
||||
|
||||
const getSpeakerThreshold = () => {
|
||||
asyncStdoutToPython("/get/data/speaker_threshold");
|
||||
};
|
||||
|
||||
const setSpeakerThreshold = (speaker_threshold) => {
|
||||
asyncStdoutToPython("/set/data/speaker_threshold", speaker_threshold);
|
||||
};
|
||||
|
||||
const getEnableAutomaticSpeakerThreshold = () => {
|
||||
pendingEnableAutomaticSpeakerThreshold();
|
||||
asyncStdoutToPython("/get/data/speaker_automatic_threshold");
|
||||
};
|
||||
|
||||
const toggleEnableAutomaticSpeakerThreshold = () => {
|
||||
pendingEnableAutomaticSpeakerThreshold();
|
||||
if (currentEnableAutomaticSpeakerThreshold.data) {
|
||||
asyncStdoutToPython("/set/disable/speaker_automatic_threshold");
|
||||
} else {
|
||||
asyncStdoutToPython("/set/enable/speaker_automatic_threshold");
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
currentSpeakerThreshold,
|
||||
getSpeakerThreshold,
|
||||
setSpeakerThreshold,
|
||||
updateSpeakerThreshold,
|
||||
|
||||
currentEnableAutomaticSpeakerThreshold,
|
||||
getEnableAutomaticSpeakerThreshold,
|
||||
toggleEnableAutomaticSpeakerThreshold,
|
||||
updateEnableAutomaticSpeakerThreshold,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user