NotecardAuxiliaryWiFi is a utility class to make external Wi-Fi functionality available to the Blues Wireless Notecard. The Notecard can then use the Wi-Fi radio to enable such functionality as Wi-Fi triangulation.
Example sketches in can be found in the examples directory.
This library takes a dependency on the note-arduino library,
which provides access to the Notecard
class. The Notecard is used to submit
data to Notehub where the values are transformed into location information.
- Open the Arduino IDE and click Tools > Manage Libraries....
- Search for "Blues" in the input box and click the "Install" button next to the "Blues Wireless Notecard Auxiliary Wi-Fi" result.
- Create a new sketch and select the Sketch > Include Library > Contributed Libraries > Blues Wireless Notecard Auxiliary Wi-Fi menu option, to add the following includes to your sketch:
#include <Notecard.h>
#include <NotecardAuxiliaryWiFi.h>
#include <Notecard.h>
#include <NotecardAuxiliaryWiFi.h>
using namespace blues;
// Create an instance of the Notecard and NotecardAuxiliaryWiFi
Notecard notecard;
NotecardAuxiliaryWiFi aux_wifi(notecard);
notecard.begin();
aux_wifi.begin();
aux_wifi.updateTriangulationData();
The examples directory contains examples for using this library with:
We love issues, fixes, and pull requests from everyone. Please run the unit-tests (as described in the following section), prior to submitting your PR. By participating in this project, you agree to abide by the Blues Inc code of conduct.
For details on contributions we accept and the process for contributing, see our contribution guide.
The unit-tests are written using the Catch2 framework, and mocking is implemented using the FakeIt framework.
From the test
directory in a terminal application, execute the following command:
g++ ../src/NotecardAuxiliaryWiFi.cpp NotecardAuxiliaryWiFi.test.cpp cjson.mock.cpp -Wall -Wextra -Wpedantic -I . -I ../src/ -I Catch2/single_include/ -I FakeIt/single_header/catch/ -DMOCK && ./a.out || echo "Tests Result: $?"
Upon success, you will see a similar message to the following:
===============================================================================
All tests passed (6 assertions in 6 test cases)
When a test fails, you will see a message similar to the following:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.out is a Catch v2.13.4 host application.
Run with -? for options
-------------------------------------------------------------------------------
NotecardAuxiliaryWiFi::updateTriangulationData() returns the value parsed from
the Notecard response
-------------------------------------------------------------------------------
NotecardAuxiliaryWiFi.test.cpp:57
...............................................................................
NotecardAuxiliaryWiFi.test.cpp:74: FAILED:
CHECK( result == JNumberValueResult+1 )
with expansion:
9.17f == 10.17f
===============================================================================
test cases: 6 | 5 passed | 1 failed
assertions: 6 | 5 passed | 1 failed
Tests Result: 1
If wish to add new functionality to the NotecardAuxiliaryWiFi
class, then
please also add the supporting unit-tests to ensure its functionality. If you
unfamiliar with the unit-testing and mocking frameworks, please use the links
above to help get started. If you are still having trouble, reach out to us in
the developer forums. Happy hacking!
Copyright (c) 2021 Blues, Inc. Released under the MIT license. See LICENSE for details.