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

adding class "aJsonFileStream" inherited from aJsonStream in order to backward- compatibility with HTTPClient library #86

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9bdd6e5
Adding the new class
anklimov Oct 5, 2016
78650a9
Merge pull request #1 from anklimov/anklimov-patch-1
anklimov Oct 5, 2016
cbaa849
Adding EEPROM Stream class
anklimov Oct 7, 2016
cc5d7c9
Update README.md
anklimov Aug 7, 2017
8ced52a
Update README.md
anklimov Aug 7, 2017
fb8f10c
Update aJSON.cpp
anklimov Oct 29, 2017
b834e6b
flush method changed in order of DUE libs compatibility
anklimov Nov 16, 2017
badb84f
some ARM compatibility added
anklimov Nov 16, 2017
60e5d57
Ported to ARM, SAM Flash write issue fixed
anklimov Jan 15, 2018
fc84958
fix compilation error on STM32F1 arch
livello Nov 5, 2018
eeefb2f
Merge pull request #2 from livello/patch-1
anklimov Nov 5, 2018
a66e679
NRF
anklimov Feb 3, 2019
d31073d
NRF
anklimov Feb 3, 2019
c567228
EEPROM stream for ESP8266 added
anklimov Mar 23, 2019
6f7bbd1
EEPROM for STM32 added
anklimov Mar 23, 2019
37db635
EEPROM for ESP8266 fix
anklimov Mar 23, 2019
e68034c
added subtype field (4 bits) to aJSON Object
anklimov May 17, 2020
8aa73b1
program API for int -> to long int modified
anklimov Nov 29, 2020
b063de5
slim global-buffer for AVR
anklimov Mar 6, 2021
a369d07
EEPROM dependancy removed back
anklimov Jul 5, 2021
f53a867
Merge branch 'master' of https://github.com/anklimov/aJson
anklimov Jul 5, 2021
2713118
added safety with NULL pointers to objects
Mar 27, 2023
be2b268
RAM saving by remove strings duplicates
Apr 8, 2023
0c23b79
Garbage stream parsing tolerance
Apr 9, 2023
6bbe201
1 bit more for subitem
Oct 8, 2023
9f17e22
rollback previous change
Oct 23, 2023
d0562f1
cleaning subtype
anklimov Nov 11, 2023
eba2e06
FLOAT_PRECISION 2
Dec 9, 2023
feb3a37
print_hidden parameter to print functions
anklimov Aug 20, 2024
263b2fe
remove ambiques declaration
anklimov Aug 20, 2024
4d0da32
print for aJson_Reserved
anklimov Sep 7, 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
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Copyright (c) 2010, Interactive Matter, Marcus Nowotny

Based on the cJSON Library, Copyright (C) 2009 Dave Gamble
Updated by anklimov - changelog on the bottom of readme

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -295,3 +296,58 @@ As soon as you call aJson.print(), it renders the structure to text.


Have Fun!

New in this fork:
adding class "aJsonFileStream" inherited from aJsonStream in order to backward- compatibility with HTTPClient library
Now is possible to operate directly with *FILE like streams, returned by HttpClient library and avoid intermediate buffering

Code example:


int getConfig()
{
FILE* result;
int returnCode ;

HTTPClient hclient("192.168.88.2",hserver,80);
result = hclient.getURI( FEED_URI);
returnCode = hclient.getLastReturnCode();

if (result!=NULL) {
if (returnCode==200) {

Serial.println("got Config :");
aJsonFileStream as=aJsonFileStream(result);
root = aJson.parse(&as);

hclient.closeStream(result); // this is very important -- be sure to close the STREAM

if (!root)
{
Serial.println("parseObject() failed");
return -11;
} else

{

char * outstr=aJson.print(root);
Serial.println(outstr);
items = aJson.getObjectItem(root,"items");
}

}
else {
Serial.print("ERROR: Server returned ");
Serial.println(returnCode);
return -11;

}

}
else {
Serial.println("failed to connect");
Serial.println(" try again in 5 seconds");
return -11;
}
return 2;
}
Loading