Files
pybricks-code/src/mpy/actions.ts
T
David Lechner 960a3163ed add support for Pybricks Profile v1.2.0
This adds support to the BLE Pybricks Profile v1.2.0. This includes a
new method to download and run programs and a new file format for the
user program.

Code for the old download and run is kept for backwards compatibility.
However, the PnP ID characteristic is no longer optional, so the
minimum Pybricks Profile is now v1.1.0.
2022-10-14 16:21:18 -05:00

39 lines
985 B
TypeScript

// SPDX-License-Identifier: MIT
// Copyright (c) 2020-2022 The Pybricks Authors
import { createAction } from '../actions';
/** Action that requests that a script is compiled. */
export const compile = createAction(
(script: string, abiVersion: number, options: string[]) => ({
type: 'mpy.action.compile',
script,
abiVersion,
options,
}),
);
export const didCompile = createAction((data: Uint8Array) => ({
type: 'mpy.action.didCompile',
data,
}));
export const didFailToCompile = createAction((err: string[]) => ({
type: 'mpy.action.didFailToCompile',
err,
}));
export const mpyCompileMulti6 = createAction(() => ({
type: 'mpy.action.compileMulti6',
}));
export const mpyDidCompileMulti6 = createAction((file: Blob) => ({
type: 'mpy.action.didCompileMulti6',
file,
}));
export const mpyDidFailToCompileMulti6 = createAction((error: string[]) => ({
type: 'mpy.action.didFailToCompileMulti6',
error,
}));