Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create the extension for MediaTek MT7697 boards #12

Open
wants to merge 158 commits into
base: master
Choose a base branch
from

Conversation

jerry73204
Copy link
Contributor

@jerry73204 jerry73204 commented Jan 28, 2018

This PR introduces the extension that controls MediaTek MT7697 boards through Bluetooth Low Energy connections. It includes both the Java source and the Arduino code on MT7697. Our work is mainly done on the files appinventor/components/src/edu/mit/appinventor/iot/mt7697/*.java and arduino-sources/*.

The extension requires the configurable ChoicePropertyEditor patch (mit-cml/appinventor-sources#993) and the BLE extension as dependency.

The PR is rebased on master branch of mit-cml/appinventor-sources and on extension/bleextension. To keep the PR clean, please make the master branch up-to-date with the master on mit-cml/appinventor-sources, if possible, or use any other strategies.

jisqyv and others added 30 commits July 28, 2016 22:48
Changed BLE Advertisements blocks to allow user input and parameters.
Finished multiple advertisement scanning. Renamed blocks to be less vague.
Update float and byte write
Renamed methods and properties by removing "Get" added upgraders.
Added checks for Bluetooth LE compatibility and for Advertisements.

Author: Andrew McKinney <[email protected]>
Author: Cristhian Ulloa <[email protected]>
Author: tiffanyle <[email protected]>

Change-Id: I78586de0922e12c7cd15f7b9911dc6bd76af2c69
Changes include:

-Moving code from scattered instance initializers into the constructor
 of BluetoothLEint.java.

-Implementing UUID validators to solve the known bugs involving non-visible
 unicode characters in UUID strings.

-Ensuring that the "Bluetooth Advertisements Not Supported" pop-up is only
 shown when the relevant blocks are used.

-Eliminating code duplication in the characteristic reading and writing
 process.

-Removed references to BluetoothLE component BluetoothLE is now an extension.

-Fixed the copyright lines in the BluetoothLE extension classes.

-Fixed the description strings in BluetoothLE.java falsely claiming that the
 extension used 1 based indexing.

-Ensured that the extension consistently accomodated for 1 based indexing.

-Implemented robust error handling.

-Partially refactored the extension to conform to the template method pattern.

Change-Id: Ic69966803964f493050ace65d6d72c475e031dd7
Change-Id: Ib9eebc4a7aa1fbd38aa3c546d2780c43132f0275
This commit adds a BLEReadOperation class and appropriate subclasses
for many of the common Bluetooth datatypes. A set of BLEReadOperations
are kept per characteristic to allow for multiple operations to be
scheduled at once, for example to read both the accelerometer and
magnetometer of a device for a navigation app.
This commit builds on the earlier refactoring of the BLE extension to
work on discrete operations. It adds implementations of write
operations that can be queued. The BluetoothLE class also gains an API
so that it can be called by other extensions.

Change-Id: I1792a3f18e1c89ecb715acfc43267e6ccd3518a3
Change-Id: If4f37f69ec4ad12bb78639bcb31fab609253fa3e
Kari reported that writing to Microbit UART occurs repeatedly with
sample app. The issue was caused by notification of the accelerometer
data constantly triggering the next operation in the queue. This is
fixed by introducing a needsRemoval flag that will be reset after a
call to runPendingOperation returns true. In this way, a pending
operation should only ever call the runPendingOperation with itself
once, instead of a potentially infinite number of times.

Change-Id: Ia861574b79ca46e8d780a666149105d6ed89b8a2
See the extension/microbit branch for the BBC micro:bit code

Change-Id: I956eee4c1cb8e1a19c81b77038e67cdcd2e891c2
Closes mit-cml#4

Change-Id: I4f88f73b805a04f770c834fce540a4fbf8d7cd39
Closes mit-cml#3

Change-Id: Idf4366f2058d8b5b040f8d6537057389150c16ef
Some users reported a NPE being reported using the StartScanning
block. It appears that on these devices we can have a race condition
where the scanner is not yet initialized and therefore fails. This
commit wraps the functionality to start the scan with a null pointer
check to mitigate the problem.

Change-Id: I188e0b944455a4c45ef1d4ec5f7f5cc576d4d6a4
The BLE extension methods take a List<?>, but due to type erasure it
is possible to pass an unchecked YailList into the extension,
resulting in ClassCastExceptions. This change updates the BLE
extension to create a copy of the input list and check/cast the values
to the appropriate type before passing it deeper into the extension.

Fixes mit-cml#7

Change-Id: I72cad6405c5bace7548d6067f2f5fc605d93f267
Change-Id: Ic5f5d83e40051cfd62504196bd71f9a9781b521f
Change-Id: I16d609f13d7818a03f4de13761aaca3d1f5c40b2
Replace the default App Logo with our new Bee based version.

Change-Id: Ibfaa3792bf29d799b253b261cd83b26e187eaa18
If a project contained multiple extensions sharing the same package
name, deleting one extension would also remove the other extensions
sharing that package name. This generally shouldn't happen going
forward because extension bundles automatically group extensions by
package name (which is why this logic is in place), but it didn't
handle the case where old extensions were in the same package.

This commit groups extensions by the components.json file that defines
them, and only deletes those extensions that are siblings by the
components.json file, rather than blanket-deleting extensions solely
by package name.

Fixes #910

Change-Id: I26a5db29a3919033fd50f2a2d65c6f805513ae2c
ClientJsonParser was calling a GWT API that used eval() to parse JSON
content rather than JSON.parse(). A maliciously crafted project
containing an extension components.json file with Javascript instead
of JSON would allow injecting arbitrary Javascript into the user's
session. This commit switches to strict parsing and includes exception
handling to report corrupt/invalid components.json to the user.

Change-Id: Iafaaf004310ac45cf0c1cea18eae1cfd58de17ef
Prior to the IOT release, extensions were packaged using the FQCN of
the extension inside of the AIX file. To faciltate being able to
contain multiple extension components in a single package, we switched
to using the package name rather than the FQCN. This causes backward
compatibility issues for extension developers who released extensions
prior to the update.

This commit adds a extensions.packagefqcn property to ant that can be
set to true by developers supporting older extensions so that the
internals of the extension package reflect the older layout. It is
recommended that all new extensions be built with the default (false)
to benefit from the new layout.

Change-Id: Idd9134c7d4d7c19f9a8869e4f88e164e2efa5cc8
A user reported an issue with a project where connecting the companion
caused the ReplMgr to go into an infinite loop. The issue was due to a
combination of setter block having an empty socket (triggering an
error resulting in the slow path) and the fact that there were more
than 20 top-level blocks in the project. After testing the first 20
blocks it would attempt the fast path, which would retrigger the slow
path, ad infinitum.

This commit updates the countdown in the slow path to use the number
of top-level blocks in the workspace rather than hard-coding 20
checks.

Fixes #887

Change-Id: Ie15b0f35cd145ecc0b789707f032eca6c179d107
Includes the favicon.ico as well as the logo

Change-Id: Ie05bd5e3a6a3f072c81c91d11aee60b52fe9905c
in Java.  Join-strings takes a list of strings and a string separator.
I concatenates the strings, with the separator interlaced, and
returns the result.  On small-memory systems (e.g., the emulator), and
with list of strings that have many elements (thousands), the Kawa
implementation was running out of stack (recursive implementation) and
blowing out memory (tail-recursive implementation).   So we'll use
a Java implementation instead.

Change-Id: Id5e9f1bf9d04f70e4a5dd181708f58d2779ccbac
Stack overflow errors (and other subclasses of java.lang.Error) were
not beign reported to the blocks editor/ReplMgr, as reported on the
forum. This commit updates runtime.scm so that Throwable is caught at
key points and if the Throwable is an Error that it is converted to a
string since the dalvikvm may not provide useful information in the
Throwable's getMessage(). This resulted in an "undefined" error due to
the lack of an error message.

Fixes #909

Change-Id: I02e2065321bd92cb566f40cb478e9ec3e9c24246
@jerry73204
Copy link
Contributor Author

Hi, it seems this PR has been long time not informed for further development.
I'll not maintain this PR due to my tight schedule. For those who are interested in the dev, these steps might be helpful.

  • This PR requires up-to-date appinventor repo. You may move and rebase these commits to appinventor-sources repo.
  • This branch is based on extension/bleextension branch, which seems to be outdated. It's better to move these commits to extension/bluetoothle.

These two steps above would conflict on the fact that master of appinventor-extension repo is not up-to-date, and appinventor-sources repo lacks extension/bluetoothle commits. If possible, to get best of two worlds, ask appinventor team to pull new commits from appinventor-sources to appinventor-extension master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.