Skip to content

Merge changes through to 3.0.7 to master #11

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

Merged
merged 33 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bf3e79a
Disable lint abortOnError
martinwork Dec 4, 2023
64cf5e5
Android Studio: AGP 4.1.1 to 7.3.1
martinwork Dec 29, 2023
a657661
Use SDK 30
martinwork Jan 3, 2024
0e08f5d
compileSdk 34
martinwork Jan 7, 2024
0d82ffd
targetSdk 33 Android 13
martinwork Jan 7, 2024
c9fa5c9
AndroidManifest - update Bluetooth permissions
martinwork Jan 7, 2024
2b58494
Modify connect & discover; update hex decoding for longer lines.
martinwork Jan 7, 2024
3fa193b
Fix long line logic
martinwork Jan 14, 2024
a406596
Modify BLE callbacks; manage service changed - refresh for V1
martinwork Jan 23, 2024
4e3ab86
Merge pull request #5 from martinwork/from288
martinwork Feb 14, 2024
b325b8a
Set version to match app
martinwork Feb 14, 2024
416e25f
Enable app to pass BuildConfig.DEBUG
martinwork Feb 27, 2024
75da7b4
Separate IntentService code from PF and BLE
martinwork Feb 27, 2024
c1f9f9a
Move main partialFlash function up
martinwork Feb 27, 2024
2deafaa
Reindent mGattCallback
martinwork Feb 27, 2024
84e4cd3
Add trace
martinwork Feb 27, 2024
8210a85
Add writeCharacteristic to avoid deprecation
martinwork Feb 27, 2024
9926501
Tidying
martinwork Feb 27, 2024
e175fdd
BluetoothGattCallback - add status checks
martinwork Feb 28, 2024
9f76625
Merge pull request #6 from martinwork/from300
martinwork Feb 29, 2024
01373b4
BluetoothGattCallback - notify lock on error status
martinwork Mar 3, 2024
d072dae
HexUtils - searchForAddress finds line containing an address
martinwork Mar 12, 2024
6c99dc0
PartialFlash - fix Python support; wait for onWriteCharacteristic
martinwork Mar 12, 2024
40ac0e6
Version 3.0.2 (52)
martinwork Mar 12, 2024
84d5370
Accept suggested library upgrades
martinwork Mar 13, 2024
a26416b
Merge pull request #7 from martinwork/from300
martinwork Mar 21, 2024
6a6ae39
Version 3.0.3 (53)
martinwork Mar 22, 2024
b0d9822
Merge pull request #8 from martinwork/from300
martinwork Mar 22, 2024
0cc9c4f
Version 3.0.4 (54)
martinwork Mar 26, 2024
384e082
Merge pull request #9 from martinwork/from300
martinwork Mar 26, 2024
222f68b
Fix for files not a multiple of 64 bytes
martinwork Apr 3, 2024
6af8f0f
Version 3.0.7 (57)
martinwork Apr 3, 2024
e8a21e1
Merge pull request #10 from martinwork/from300
martinwork Apr 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,11 @@ lint/tmp/
# Android Profiling
*.hprof

# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 29
compileSdk 34

defaultConfig {
minSdkVersion 19
targetSdkVersion 29
targetSdk 33
}

buildTypes {
Expand All @@ -14,12 +14,16 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
namespace 'org.microbit.partialflashing'
lint {
abortOnError false
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-annotations:+'
implementation "com.android.support:appcompat-v7:23.0.0"
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
}


12 changes: 7 additions & 5 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.microbit.partialflashing"
android:versionCode="1"
android:versionName="1.1" >
android:versionCode="57"
android:versionName="3.0.7" >

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30"/>

<!-- API 31 Needed only if your app communicates with already-paired Bluetooth devices. -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
</manifest>
62 changes: 60 additions & 2 deletions src/main/java/org/microbit/android/partialflashing/HexUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,66 @@ public int searchForDataRegEx(String search) throws IOException {
// Return -1 if no match
return -1;
}


/*
* A function to search for an address in a hex file
* @param search the address to search for
* @return the index of the address. -1 if not found.
*/
public int searchForAddress( long address) throws IOException {
long lastBaseAddr = 0;
String data;
// Iterate through
ListIterator i = hexLines.listIterator();
while ( i.hasNext()) {
// Have to call nextIndex() before next()
int index = i.nextIndex();
String line = i.next().toString();

switch (getRecordType(line)) {
case 2: { // Extended Segment Address
data = getRecordData(line);
if ( data.length() != 4) {
return -1;
}
int hi = Integer.parseInt( data.substring(0, 1), 16);
int lo = Integer.parseInt( data.substring(1), 16);
lastBaseAddr = (long) hi * (long) 0x1000 + (long) lo * (long) 0x10;
if ( lastBaseAddr > address) {
return -1;
}
break;
}
case 4: {
data = getRecordData(line);
if ( data.length() != 4) {
return -1;
}
lastBaseAddr = Integer.parseInt( data, 16);
lastBaseAddr *= (long) 0x10000;
if ( lastBaseAddr > address) {
return -1;
}
break;
}
case 0:
case 0x0D: {
if ( address - lastBaseAddr < 0x10000) {
long a = lastBaseAddr + getRecordAddress(line);
int n = getRecordDataLength( line) / 2; // bytes
if ( a <= address && a + n > address) {
return index;
}
}
break;
}
}
}

// Return -1 if no match
return -1;
}

/*
* Returns data from an index
* @param index
Expand Down Expand Up @@ -267,6 +326,5 @@ public static byte[] recordToByteArray(String hexString, int offset, int packetN

return data;
}

}

Loading