mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
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.
39 lines
985 B
TypeScript
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,
|
|
}));
|