2017-06-29 12:54:02 -06:00
|
|
|
import { BotStateTree } from "farmbot";
|
|
|
|
import {
|
|
|
|
McuParamName,
|
|
|
|
ConfigurationName,
|
|
|
|
Dictionary,
|
|
|
|
SyncStatus,
|
2017-08-04 14:42:29 -06:00
|
|
|
FarmwareManifest,
|
|
|
|
LocationName
|
2017-06-29 12:54:02 -06:00
|
|
|
} from "farmbot";
|
|
|
|
import { AuthState } from "../auth/interfaces";
|
|
|
|
import {
|
|
|
|
TaggedImage,
|
|
|
|
TaggedPeripheral,
|
|
|
|
TaggedDevice
|
|
|
|
} from "../resources/tagged_resources";
|
2017-11-30 20:43:35 -07:00
|
|
|
import { RestResources, ResourceIndex } from "../resources/interfaces";
|
2017-06-29 12:54:02 -06:00
|
|
|
import { TaggedUser } from "../resources/tagged_resources";
|
2017-07-28 15:24:21 -06:00
|
|
|
import { WD_ENV } from "../farmware/weed_detector/remote_env/interfaces";
|
2018-01-04 08:18:20 -07:00
|
|
|
import { ConnectionStatus, ConnectionState } from "../connectivity/interfaces";
|
2017-12-16 17:16:19 -07:00
|
|
|
import { IntegerSize } from "../util";
|
2017-06-29 12:54:02 -06:00
|
|
|
|
|
|
|
export interface Props {
|
2017-10-02 08:58:03 -06:00
|
|
|
userToApi: ConnectionStatus | undefined;
|
|
|
|
userToMqtt: ConnectionStatus | undefined;
|
|
|
|
botToMqtt: ConnectionStatus | undefined;
|
2017-06-29 12:54:02 -06:00
|
|
|
auth: AuthState | undefined;
|
|
|
|
bot: BotState;
|
|
|
|
deviceAccount: TaggedDevice;
|
|
|
|
images: TaggedImage[];
|
|
|
|
dispatch: Function;
|
2017-11-30 20:43:35 -07:00
|
|
|
resources: ResourceIndex;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/** How the device is stored in the API side.
|
|
|
|
* This is what comes back from the API as JSON.
|
|
|
|
*/
|
|
|
|
export interface DeviceAccountSettings {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
timezone?: string | undefined;
|
2017-12-28 09:49:58 -07:00
|
|
|
tz_offset_hrs: number;
|
2017-10-03 09:03:06 -06:00
|
|
|
last_saw_api?: string | undefined;
|
|
|
|
last_saw_mq?: string | undefined;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface BotState {
|
2017-11-22 07:46:47 -07:00
|
|
|
/** The browser optimistically overwrites FBOS sync status to "syncing..."
|
|
|
|
* to reduce UI latency. When AJAX/sync operations fail, we need
|
|
|
|
* a mechanism to rollback the update to the previous value. We store the
|
|
|
|
* value of the status prior to the update here for safety */
|
2017-11-21 15:24:34 -07:00
|
|
|
statusStash?: SyncStatus | undefined;
|
2017-06-29 12:54:02 -06:00
|
|
|
/** How many steps to move when the user presses a manual movement arrow */
|
|
|
|
stepSize: number;
|
|
|
|
/** The current os version on the github release api */
|
|
|
|
currentOSVersion?: string;
|
2018-01-10 17:37:36 -07:00
|
|
|
/** The current beta os version on the github release api */
|
|
|
|
currentBetaOSVersion?: string;
|
2017-06-29 12:54:02 -06:00
|
|
|
/** Is the bot in sync with the api */
|
|
|
|
dirty: boolean;
|
|
|
|
/** The state of the bot, as reported by the bot over MQTT. */
|
|
|
|
hardware: HardwareState;
|
|
|
|
/** Hardware settings auto update on blur. Tells the UI if it should load a
|
|
|
|
* spinner or not. */
|
|
|
|
isUpdating?: boolean;
|
|
|
|
controlPanelState: ControlPanelState;
|
2017-11-20 12:44:46 -07:00
|
|
|
/** Have all API requests been acknowledged by external services? This flag
|
|
|
|
* lets us know if it is safe to do data critical tasks with the bot */
|
|
|
|
consistent: boolean;
|
2018-01-04 08:18:20 -07:00
|
|
|
connectivity: ConnectionState;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
2018-01-10 13:08:56 -07:00
|
|
|
export interface BotProp { bot: BotState; }
|
2017-06-29 12:54:02 -06:00
|
|
|
|
|
|
|
/** Status registers for the bot's status */
|
|
|
|
export type HardwareState = BotStateTree;
|
|
|
|
|
|
|
|
export interface GithubRelease {
|
|
|
|
tag_name: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface MoveRelProps {
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
z: number;
|
|
|
|
speed?: number | undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type Xyz = "x" | "y" | "z";
|
|
|
|
export type Axis = Xyz | "all";
|
|
|
|
|
2017-08-02 17:59:34 -06:00
|
|
|
export type BotPosition = Record<Xyz, (number | undefined)>;
|
2017-10-20 00:26:41 -06:00
|
|
|
export type BotLocationData = Record<LocationName, BotPosition>;
|
2017-08-02 17:59:34 -06:00
|
|
|
|
2017-08-31 14:42:16 -06:00
|
|
|
export type StepsPerMmXY = Record<"x" | "y", (number | undefined)>;
|
|
|
|
|
2017-06-29 12:54:02 -06:00
|
|
|
export interface CalibrationButtonProps {
|
|
|
|
disabled: boolean;
|
|
|
|
axis: Axis;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface FarmbotOsProps {
|
|
|
|
bot: BotState;
|
|
|
|
account: TaggedDevice;
|
|
|
|
auth: AuthState;
|
|
|
|
dispatch: Function;
|
|
|
|
}
|
|
|
|
|
2018-01-11 23:18:26 -07:00
|
|
|
export interface FarmbotOsState {
|
|
|
|
osReleaseNotes: string;
|
|
|
|
}
|
|
|
|
|
2017-08-24 17:55:35 -06:00
|
|
|
export interface CameraSelectionProps {
|
|
|
|
env: Dictionary<string | undefined>
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CameraSelectionState {
|
2017-06-29 12:54:02 -06:00
|
|
|
cameraStatus: "" | "sending" | "done" | "error";
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface StepsPerMMBoxProps {
|
|
|
|
bot: BotState;
|
|
|
|
setting: ConfigurationName;
|
|
|
|
dispatch: Function;
|
2017-12-01 21:32:26 -07:00
|
|
|
disabled?: boolean;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface McuInputBoxProps {
|
|
|
|
bot: BotState;
|
|
|
|
setting: McuParamName;
|
|
|
|
dispatch: Function;
|
2017-12-16 17:16:19 -07:00
|
|
|
intSize?: IntegerSize;
|
2017-12-20 15:22:35 -07:00
|
|
|
filter?: number;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface EStopButtonProps {
|
|
|
|
bot: BotState;
|
|
|
|
user: TaggedUser | undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PeripheralsProps {
|
|
|
|
resources: RestResources;
|
|
|
|
bot: BotState;
|
|
|
|
peripherals: TaggedPeripheral[];
|
|
|
|
dispatch: Function;
|
2017-08-11 19:56:02 -06:00
|
|
|
disabled: boolean | undefined;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface FarmwareProps {
|
|
|
|
dispatch: Function;
|
|
|
|
env: Partial<WD_ENV>;
|
2017-10-10 22:29:12 -06:00
|
|
|
user_env: Record<string, string | undefined>;
|
2017-06-29 12:54:02 -06:00
|
|
|
images: TaggedImage[];
|
|
|
|
currentImage: TaggedImage | undefined;
|
|
|
|
syncStatus: SyncStatus;
|
|
|
|
farmwares: Dictionary<FarmwareManifest | undefined>;
|
2017-12-28 13:48:03 -07:00
|
|
|
timeOffset: number;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface HardwareSettingsProps {
|
|
|
|
controlPanelState: ControlPanelState;
|
|
|
|
dispatch: Function;
|
|
|
|
bot: BotState;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ControlPanelState {
|
|
|
|
homing_and_calibration: boolean;
|
|
|
|
motors: boolean;
|
|
|
|
encoders_and_endstops: boolean;
|
|
|
|
danger_zone: boolean;
|
2017-12-01 21:32:26 -07:00
|
|
|
power_and_reset: boolean;
|
2017-12-16 18:21:13 -07:00
|
|
|
pin_guard: boolean;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|