From 65c2f0cce2d1473abc246316e219e8af23bccd69 Mon Sep 17 00:00:00 2001 From: skarg Date: Tue, 17 Jan 2006 16:30:27 +0000 Subject: [PATCH] Added makefile for linux port of writefile demo example. --- bacnet-stack/demo/writefile/writefile.c | 11 ++-- bacnet-stack/writefile.mak | 69 +++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 bacnet-stack/writefile.mak diff --git a/bacnet-stack/demo/writefile/writefile.c b/bacnet-stack/demo/writefile/writefile.c index 24b21479..b662958e 100644 --- a/bacnet-stack/demo/writefile/writefile.c +++ b/bacnet-stack/demo/writefile/writefile.c @@ -174,7 +174,7 @@ static uint8_t Send_Atomic_Write_File_Stream( } else fprintf(stderr,"Failed to Send AtomicWriteFile Request " - "(payload [%d] exceeds octet string capacity)!\n"); + "(payload [%d] exceeds octet string capacity)!\n",pdu_len); } return invoke_id; @@ -352,7 +352,10 @@ int main(int argc, char *argv[]) if (current_seconds != last_seconds) tsm_timer_milliseconds(((current_seconds - last_seconds) * 1000)); if (End_Of_File_Detected || Error_Detected) + { + printf("\r\n"); break; + } if (I_Am_Request) { I_Am_Request = false; @@ -368,14 +371,14 @@ int main(int argc, char *argv[]) if (found) { /* calculate the smaller of our APDU size or theirs - and remove the overhead of the APDU (about 20 octets max). + and remove the overhead of the APDU (about 24 octets max). note: we could fail if there is a bottle neck (router) and smaller MPDU in betweeen. */ if (max_apdu < MAX_APDU) my_max_apdu = max_apdu; else my_max_apdu = MAX_APDU; - requestedOctetCount = my_max_apdu - 20; + requestedOctetCount = my_max_apdu - 24; /* has the previous invoke id expired or returned? note: invoke ID = 0 is invalid, so it will be idle */ if ((invoke_id == 0) || tsm_invoke_id_free(invoke_id)) @@ -397,6 +400,8 @@ int main(int argc, char *argv[]) octetstring_truncate(&fileData,len); fclose(pFile); } + else + End_Of_File_Detected = true; printf("\rSending %d bytes",(fileStartPosition+len)); invoke_id = Send_Atomic_Write_File_Stream( Target_Device_Object_Instance, diff --git a/bacnet-stack/writefile.mak b/bacnet-stack/writefile.mak new file mode 100644 index 00000000..6850b7f8 --- /dev/null +++ b/bacnet-stack/writefile.mak @@ -0,0 +1,69 @@ +#Makefile to build BACnet Application for the Linux Port +CC = gcc +BASEDIR = . +#CFLAGS = -Wall -I. +# -g for debugging with gdb +#CFLAGS = -Wall -I. -O2 -g +# Note: you can strip out symbols using the strip command +# to get an idea of how big the compile really is. +#DEFINES = -DBACFILE=1 -DBACDL_ETHERNET=1 +#DEFINES = -DBACFILE=1 -DBACDL_ARCNET=1 +#DEFINES = -DBACFILE=1 -DBACDL_MSTP=1 +DEFINES = -DBACFILE=1 -DBACDL_BIP=1 +INCLUDES = -I. -Iports/linux -Idemo/object -Idemo/handler + +CFLAGS = -Wall -g $(INCLUDES) $(DEFINES) + +TARGET = writefile + +SRCS = demo/writefile/writefile.c \ + ports/linux/bip-init.c \ + bip.c \ + demo/handler/txbuf.c \ + demo/handler/noserv.c \ + demo/handler/h_whois.c \ + demo/handler/h_rp.c \ + rp.c \ + bacdcode.c \ + bacapp.c \ + bacprop.c \ + bacstr.c \ + bactext.c \ + indtext.c \ + bigend.c \ + whois.c \ + iam.c \ + tsm.c \ + datalink.c \ + address.c \ + demo/object/device.c \ + demo/object/ai.c \ + demo/object/ao.c \ + demo/object/bacfile.c \ + arf.c \ + awf.c \ + abort.c \ + reject.c \ + bacerror.c \ + apdu.c \ + npdu.c + +OBJS = ${SRCS:.c=.o} + +all: ${TARGET} + +${TARGET}: ${OBJS} + ${CC} -o $@ ${OBJS} + +.c.o: + ${CC} -c ${CFLAGS} $*.c -o $@ + +depend: + rm -f .depend + ${CC} -MM ${CFLAGS} *.c >> .depend + +clean: + rm -rf core ${TARGET} $(OBJS) *.bak ports/linux/*.bak *.1 *.ini + +include: .depend +