资源简介
arduino Json 数据库
aJson-master--JSON数据格式库
代码片段和文件信息
/*
Copyright (c) 2001 Interactive Matter Marcus Nowotny
based on the cJSON Library Copyright (C) 2009 Dave Gamble
Permission is hereby granted free of charge to any person obtaining a copy
of this software and associated documentation files (the “Software“) to deal
in the Software without restriction including without limitation the rights
to use copy modify merge publish distribute sublicense and/or sell
copies of the Software and to permit persons to whom the Software is
furnished to do so subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// aJSON
// aJson Library for Arduino.
// This library is suited for Atmega328 based Arduinos.
// The RAM on ATmega168 based Arduinos is too limited
/******************************************************************************
* Includes
******************************************************************************/
#include
#include
#include
#include
#include
#include
#include “aJSON.h“
#include “utility/stringbuffer.h“
/******************************************************************************
* Definitions
******************************************************************************/
//Default buffer sizes - buffers get initialized and grow acc to that size
#define BUFFER_DEFAULT_SIZE 4
//how much digits after . for float
#define FLOAT_PRECISION 5
bool
aJsonStream::available()
{
if (bucket != EOF)
return true;
while (stream()->available())
{
/* Make an effort to skip whitespace. */
int ch = this->getch();
if (ch > 32)
{
this->ungetch(ch);
return true;
}
}
return false;
}
int
aJsonStream::getch()
{
if (bucket != EOF)
{
int ret = bucket;
bucket = EOF;
return ret;
}
while (!stream()->available()) /* spin */;
return stream()->read();
}
void
aJsonStream::ungetch(char ch)
{
bucket = ch;
}
size_t
aJsonStream::write(uint8_t ch)
{
return stream()->write(ch);
}
size_t
aJsonStream::readBytes(uint8_t *buffer size_t len)
{
for (size_t i = 0; i < len; i++)
{
int ch = this->getch();
if (ch == EOF)
{
return i;
}
buffer[i] = ch;
}
return len;
}
int
aJsonClientStream::getch()
{
if (bucket != EOF)
{
int ret = bucket;
bucket = EOF;
return ret;
}
while (!stream()->available() &&
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-11-07 14:52 aJson-master\
文件 89 2012-11-07 14:52 aJson-master\.gitignore
目录 0 2012-11-07 14:52 aJson-master\Examples\
目录 0 2012-11-07 14:52 aJson-master\Examples\Json_Example\
文件 7218 2012-11-07 14:52 aJson-master\Examples\Json_Example\Json_Example.ino
目录 0 2012-11-07 14:52 aJson-master\Examples\Json_Serial\
文件 2531 2012-11-07 14:52 aJson-master\Examples\Json_Serial\Json_Serial.ino
目录 0 2012-11-07 14:52 aJson-master\Examples\MultiLevelParsing\
文件 2368 2012-11-07 14:52 aJson-master\Examples\MultiLevelParsing\MultiLevelParsing.ino
文件 10607 2012-11-07 14:52 aJson-master\README.md
文件 26409 2012-11-07 14:52 aJson-master\aJSON.cpp
文件 9624 2012-11-07 14:52 aJson-master\aJSON.h
文件 1460 2012-11-07 14:52 aJson-master\keywords.txt
目录 0 2012-11-07 14:52 aJson-master\utility\
文件 3277 2012-11-07 14:52 aJson-master\utility\stringbuffer.c
文件 1261 2012-11-07 14:52 aJson-master\utility\stringbuffer.h
评论
共有 条评论