Skip to content

Commit

Permalink
restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
smlng committed May 31, 2016
1 parent 7875df7 commit 0495925
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 11 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Real IoT Makers

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.
File renamed without changes.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CFLAGS += -Wall -DMICROCOAP_DEBUG
CFLAGS += -Wall -Wextra -O2 -g -DMICROCOAP_DEBUG -I.
# -DIPV6
SRC = $(wildcard *.c)
DIRS = example
SRC = coap.c example/endpoints.c example/main.c
OBJ = $(SRC:%.c=%.o)
DEPS = $(SRC:%.c=%.d)
EXEC = coap
Expand Down
2 changes: 1 addition & 1 deletion coap.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ int coap_build_endpoints(const coap_endpoint_t *endpoints, char *buf, size_t buf
strncat(buf, "<", len);
len--;

for (size_t i = 0; i < ep->path->count; i++) {
for (int i = 0; i < ep->path->count; i++) {
strncat(buf, "/", len);
len--;

Expand Down
1 change: 0 additions & 1 deletion coap.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ int coap_handle_request(const coap_endpoint_t *endpoints,
const coap_packet_t *inpkt, coap_packet_t *outpkt);
int coap_build_endpoints(const coap_endpoint_t *endpoints,
char *buf, size_t buflen);
void endpoint_setup(const coap_endpoint_t *endpoints);

#ifdef __cplusplus
}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion main-posix.c → example/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
extern void endpoint_setup(const coap_endpoint_t *endpoints);
extern const coap_endpoint_t endpoints[];

int main(int argc, char **argv)
int main(void)
{
int fd;
#ifdef IPV6
Expand Down
10 changes: 4 additions & 6 deletions microcoap.ino → example/microcoap.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void setup()
{
int i;
Serial.begin(9600);
while (!Serial)
while (!Serial)
{
; // wait for serial port to connect. Needed for Leonardo only
}
Expand All @@ -37,12 +37,11 @@ void setup()
for (i=0;i<4;i++)
{
Serial.print(Ethernet.localIP()[i], DEC);
Serial.print(".");
Serial.print(".");
}
Serial.println();
udp.begin(PORT);

coap_setup();
endpoint_setup();
}

Expand All @@ -60,7 +59,7 @@ void loop()
int rc;
coap_packet_t pkt;
int i;

if ((sz = udp.parsePacket()) > 0)
{
udp.read(packetbuf, sizeof(packetbuf));
Expand All @@ -81,7 +80,7 @@ void loop()
{
size_t rsplen = sizeof(packetbuf);
coap_packet_t rsppkt;
coap_handle_req(&scratch_buf, &pkt, &rsppkt);
coap_handle_request(&scratch_buf, &pkt, &rsppkt);

memset(packetbuf, 0, UDP_TX_PACKET_MAX_SIZE);
if (0 != (rc = coap_build(packetbuf, &rsplen, &rsppkt)))
Expand All @@ -96,4 +95,3 @@ void loop()
}
}
}

0 comments on commit 0495925

Please sign in to comment.