-
Notifications
You must be signed in to change notification settings - Fork 588
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
Add support for scanning for mock devices using ScanSettings and Scan… #703
Add support for scanning for mock devices using ScanSettings and Scan… #703
Conversation
Hello, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments for discussion
mockrxandroidble/src/main/java/com/polidea/rxandroidble2/mockrxandroidble/RxBleClientMock.java
Outdated
Show resolved
Hide resolved
mockrxandroidble/src/main/java/com/polidea/rxandroidble2/mockrxandroidble/RxBleClientMock.java
Outdated
Show resolved
Hide resolved
return bb.array(); | ||
} | ||
|
||
private static boolean filterDevice(RxBleDevice rxBleDevice, ScanFilter... scanFilters) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why it is RxBleDevice
here where it is clearly meant for RxBleDeviceMock
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me neither...copied from the original method private static boolean filterDevice(RxBleDevice rxBleDevice, @Nullable UUID[] filterServiceUUIDs) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I need to change this? I don't think it matters really.
mockrxandroidble/src/main/java/com/polidea/rxandroidble2/mockrxandroidble/RxBleClientMock.java
Outdated
Show resolved
Hide resolved
...androidble/src/main/java/com/polidea/rxandroidble2/mockrxandroidble/RxBleScanRecordMock.java
Outdated
Show resolved
Hide resolved
…xandroidble/RxBleClientMock.java Link in comment block Co-authored-by: Dariusz Seweryn <[email protected]>
rxandroidble/src/main/java/com/polidea/rxandroidble2/scan/ScanFilter.java
Outdated
Show resolved
Hide resolved
PR #706 is based on this PR and would be preferred instead of this PR to avoid creating new APIs that are later deprecated, although if both are merged between releases it wouldn't really matter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I have posted this review before the weekend but it turned out I didn't :/
To not be overwhelmed by stacked changes I would like to merge your PRs sequentially starting with this one and proceeding with next.
rxandroidble/src/main/java/com/polidea/rxandroidble2/scan/ScanFilter.java
Outdated
Show resolved
Hide resolved
rxandroidble/src/main/java/com/polidea/rxandroidble2/scan/ScanResultInterface.java
Outdated
Show resolved
Hide resolved
I know, unfortunately partial code reviews are not currying and I would like to first merge this one before starting review of the next — this way #706 will show only differences with |
Oh sorry yes that's fine – I misread your comment and thought you wanted me to do some merging. I was only concerned about having to maintain deprecated constructors if releases were made between PRs. |
rxandroidble/src/main/java/com/polidea/rxandroidble2/scan/ScanResult.java
Outdated
Show resolved
Hide resolved
rxandroidble/src/main/java/com/polidea/rxandroidble2/scan/ScanFilter.java
Outdated
Show resolved
Hide resolved
rxandroidble/src/test/groovy/com/polidea/rxandroidble2/scan/ScanFilterTest.groovy
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this? eb7d009
Also move the |
Correct. If you would move the interface from |
…vert ScanResult changes
Got it, see latest commit. Got confused for a minute there! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there :)
mockrxandroidble/src/main/java/com/polidea/rxandroidble2/mockrxandroidble/RxBleClientMock.java
Outdated
Show resolved
Hide resolved
…xandroidble/RxBleClientMock.java Co-authored-by: Dariusz Seweryn <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 👍 🚀
|
||
class ScanFilterTest extends Specification { | ||
@Config(manifest = Config.NONE, constants = BuildConfig, sdk = Build.VERSION_CODES.LOLLIPOP) | ||
public class ScanFilterTest extends ElectricSpecification { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I totally forgot about it. 👍
I'd love to have this for my unit tests. However, there hasn't been a release in nearly a year. Is another planned soon? |
@rfrowe It seems Polidea was bought out - I’m trying to reach out to Dariusz to see what’s happening and if he’ll continue maintaining it. If not I’ll look at maintaining and releasing a fork as we need this to work for commercial projects. |
@nrbrook oof did this happen quite recently? I figured this project was still active when I chose to use it, since the last commit was in January. For now, I set Gradle to install this library from git via JitPack so I can use this change, but if you do end up forking and releasing to Maven, let me know :) |
Nice I didn’t know you could do that via jitpack. Acquired February 8th according to linked in. |
@nrbrook if you're interested:
where
|
There is now a |
…Filter(s)
Added implementation and unit tests