Skip to content

Commit c78cfe7

Browse files
authored
chore: update note-c (#34)
* remove note-c before re-add * Squashed 'src/note-c/' content from commit 9dc64f0 git-subtree-dir: src/note-c git-subtree-split: 9dc64f06dfadc50847c92dd0b4bc7e8946ae6c1d * chore: update note-c
1 parent b120270 commit c78cfe7

File tree

6 files changed

+343
-11
lines changed

6 files changed

+343
-11
lines changed

CONTRIBUTING.md

+2
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ clean up inconsistent whitespace )
4242
We will happily reopen the issue.
4343

4444
## Submitting a Pull Request
45+
4546
1. [Fork][fork] the [official repository][repo].
4647
2. [Create a topic branch.][branch]
4748
3. Implement your feature or bug fix.
4849
4. Add, commit, and push your changes.
4950
5. [Submit a pull request.][pr]
5051

5152
## Notes
53+
5254
* Please add tests if you changed code. Contributions without tests won't be
5355
* accepted. If you don't know how to add tests, please put in a PR and leave a
5456
* comment asking for help. We love helping!

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Blues Wireless Notecard
2-
version=1.2.9
2+
version=1.2.10
33
author=Blues Wireless
44
maintainer=Blues Wireless <[email protected]>
55
sentence=An easy to use Notecard Library for Arduino.

src/note-c/README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ This library allows you to control a Notecard by writing a C
77
or C++ program. Your program may programmatically configure Notecard and send
88
Notes to [Notehub.io][notehub].
99

10-
This library is used by the [note-arduino library][note-arduino], which includes
11-
it as a git submodule.
10+
This library is used by the [note-arduino library][note-arduino], which includes it as a git submodule.
1211

1312
## Documentation
1413

15-
The documentation for this library can be found
16-
[here](https://blues.github.io/note-c/html/index.html).
14+
The documentation for this library can be found [here](https://blues.github.io/note-c/html/index.html).
1715

1816
## Contributing
1917

@@ -47,4 +45,4 @@ Copyright (c) 2019 Blues Inc. Released under the MIT license. See
4745
[note-arduino]: https://github.com/blues/note-arduino
4846
[note-go]: https://github.com/blues/note-go
4947
[note-python]: https://github.com/blues/note-python
50-
[code of conduct]: https://blues.github.io/opensource/code-of-conduct
48+
[code of conduct]: https://blues.github.io/opensource/code-of-conduct

src/note-c/n_helpers.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,11 @@ int NoteGetEnvInt(const char *variable, int defaultVal) {
396396
@param defaultVal The variable value.
397397
@param buf (out) The buffer in which to place the variable value.
398398
@param buflen The length of the output buffer.
399+
@returns true if there is no error (JSON response with no explicit error)
399400
*/
400401
/**************************************************************************/
401-
void NoteGetEnv(const char *variable, const char *defaultVal, char *buf, uint32_t buflen) {
402+
bool NoteGetEnv(const char *variable, const char *defaultVal, char *buf, uint32_t buflen) {
403+
bool success = false;
402404
if (defaultVal == NULL)
403405
buf[0] = '\0';
404406
else
@@ -409,13 +411,15 @@ void NoteGetEnv(const char *variable, const char *defaultVal, char *buf, uint32_
409411
J *rsp = NoteRequestResponse(req);
410412
if (rsp != NULL) {
411413
if (!NoteResponseError(rsp)) {
414+
success = true;
412415
char *val = JGetString(rsp, "text");
413416
if (val[0] != '\0')
414417
strlcpy(buf, val, buflen);
415418
}
416419
NoteDeleteResponse(rsp);
417420
}
418421
}
422+
return success;
419423
}
420424

421425
//**************************************************************************/
@@ -830,7 +834,7 @@ bool NoteWake(int stateLen, void *state) {
830834
return false;
831835

832836
// Send it a command to request the saved state
833-
JAddBoolToObject(req, "sync", true);
837+
JAddBoolToObject(req, "start", true);
834838
J *rsp = NoteRequestResponse(req);
835839
if (rsp == NULL)
836840
return false;
@@ -1074,7 +1078,7 @@ bool NoteAdd(const char *target, J *body, bool urgent) {
10741078

10751079
// Initiate sync NOW if it's urgent
10761080
if (urgent)
1077-
JAddBoolToObject(req, "sync", true);
1081+
JAddBoolToObject(req, "start", true);
10781082

10791083
// Perform the transaction
10801084
return NoteRequest(req);
@@ -1216,8 +1220,8 @@ bool NoteGetContact(char *nameBuf, int nameBufLen, char *orgBuf, int orgBufLen,
12161220
strlcpy(roleBuf, JGetString(rsp, "role"), roleBufLen);
12171221
if (emailBuf != NULL)
12181222
strlcpy(emailBuf, JGetString(rsp, "email"), emailBufLen);
1219-
NoteDeleteResponse(rsp);
12201223
}
1224+
NoteDeleteResponse(rsp);
12211225
}
12221226

12231227
return success;

0 commit comments

Comments
 (0)