Fixed up most warnings after bacdcode changes to unsigned and signed decoding.

Fixed up the Visual C++ demo in ports/win32/bacnet/
This commit is contained in:
skarg
2006-01-16 15:00:22 +00:00
parent 2adca3320d
commit cabdeab081
25 changed files with 138 additions and 125 deletions
+4 -4
View File
@@ -48,14 +48,14 @@ typedef struct BACnet_Atomic_Read_File_Data
{ {
struct struct
{ {
int fileStartPosition; int32_t fileStartPosition;
unsigned requestedOctetCount; uint32_t requestedOctetCount;
} stream; } stream;
struct struct
{ {
int fileStartRecord; int32_t fileStartRecord;
// requested or returned record count // requested or returned record count
unsigned RecordCount; uint32_t RecordCount;
} record; } record;
} type; } type;
BACNET_OCTET_STRING fileData; BACNET_OCTET_STRING fileData;
+3 -3
View File
@@ -47,12 +47,12 @@ typedef struct BACnet_Atomic_Write_File_Data
{ {
struct struct
{ {
int fileStartPosition; int32_t fileStartPosition;
} stream; } stream;
struct struct
{ {
int fileStartRecord; int32_t fileStartRecord;
unsigned returnedRecordCount; uint32_t returnedRecordCount;
} record; } record;
} type; } type;
BACNET_OCTET_STRING fileData; BACNET_OCTET_STRING fileData;
+2 -2
View File
@@ -46,8 +46,8 @@ typedef struct BACnet_Application_Data_Value
{ {
/* NULL - not needed as it is encoded in the tag alone */ /* NULL - not needed as it is encoded in the tag alone */
bool Boolean; bool Boolean;
unsigned Unsigned_Int; uint32_t Unsigned_Int;
int Signed_Int; int32_t Signed_Int;
float Real; float Real;
double Double; double Double;
BACNET_OCTET_STRING Octet_String; BACNET_OCTET_STRING Octet_String;
+5 -5
View File
@@ -1110,10 +1110,10 @@ int encode_bacnet_unsigned(uint8_t * apdu, uint32_t value)
int len = 0; // return value int len = 0; // return value
if (value < 0x100) { if (value < 0x100) {
apdu[0] = value; apdu[0] = (uint8_t)value;
len = 1; len = 1;
} else if (value < 0x10000) { } else if (value < 0x10000) {
len = encode_unsigned16(&apdu[0],value); len = encode_unsigned16(&apdu[0],(uint16_t)value);
} else if (value < 0x1000000) { } else if (value < 0x1000000) {
len = encode_unsigned24(&apdu[0],value); len = encode_unsigned24(&apdu[0],value);
} else { } else {
@@ -1187,7 +1187,7 @@ int decode_unsigned(uint8_t * apdu, uint32_t len_value, uint32_t *value)
// returns the number of apdu bytes consumed // returns the number of apdu bytes consumed
int decode_enumerated(uint8_t * apdu, uint32_t len_value, int *value) int decode_enumerated(uint8_t * apdu, uint32_t len_value, int *value)
{ {
unsigned unsigned_value = 0; uint32_t unsigned_value = 0;
int len; int len;
len = decode_unsigned(apdu, len_value, &unsigned_value); len = decode_unsigned(apdu, len_value, &unsigned_value);
@@ -1280,9 +1280,9 @@ int encode_bacnet_signed(uint8_t * apdu, int32_t value)
octet is 0, and the first octet shall not be X'FF' if the most octet is 0, and the first octet shall not be X'FF' if the most
significant bit of the second octet is 1. */ significant bit of the second octet is 1. */
if ((value >= -128) && (value < 128)) { if ((value >= -128) && (value < 128)) {
len = encode_signed8(&apdu[0],value); len = encode_signed8(&apdu[0],(int8_t)value);
} else if ((value >= -32768) && (value < 32768)) { } else if ((value >= -32768) && (value < 32768)) {
len = encode_signed16(&apdu[0],value); len = encode_signed16(&apdu[0],(int16_t)value);
} else if ((value > -8388608) && (value < 8388608)) { } else if ((value > -8388608) && (value < 8388608)) {
len = encode_signed24(&apdu[0],value); len = encode_signed24(&apdu[0],value);
} else { } else {
+1 -3
View File
@@ -34,14 +34,12 @@
#include "apdu.h" #include "apdu.h"
#include "npdu.h" #include "npdu.h"
#include "abort.h" #include "abort.h"
#include "rp.h" #include "arf.h"
/* demo objects */ /* demo objects */
#include "device.h" #include "device.h"
#include "ai.h" #include "ai.h"
#include "ao.h" #include "ao.h"
#if BACFILE
#include "bacfile.h" #include "bacfile.h"
#endif
void handler_atomic_read_file( void handler_atomic_read_file(
uint8_t *service_request, uint8_t *service_request,
+1
View File
@@ -24,6 +24,7 @@
*********************************************************************/ *********************************************************************/
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#include "config.h" #include "config.h"
#include "txbuf.h" #include "txbuf.h"
#include "bacdef.h" #include "bacdef.h"
-2
View File
@@ -43,8 +43,6 @@
#include "bacfile.h" #include "bacfile.h"
#endif #endif
static uint8_t Temp_Buf[MAX_APDU] = {0};
void handler_write_property( void handler_write_property(
uint8_t *service_request, uint8_t *service_request,
uint16_t service_len, uint16_t service_len,
+1
View File
@@ -24,6 +24,7 @@
*********************************************************************/ *********************************************************************/
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <errno.h>
#include "config.h" #include "config.h"
#include "config.h" #include "config.h"
#include "txbuf.h" #include "txbuf.h"
+1
View File
@@ -24,6 +24,7 @@
*********************************************************************/ *********************************************************************/
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <errno.h>
#include "config.h" #include "config.h"
#include "config.h" #include "config.h"
#include "txbuf.h" #include "txbuf.h"
+1
View File
@@ -24,6 +24,7 @@
*********************************************************************/ *********************************************************************/
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <errno.h>
#include "config.h" #include "config.h"
#include "config.h" #include "config.h"
#include "txbuf.h" #include "txbuf.h"
+6 -3
View File
@@ -608,7 +608,8 @@ bool Device_Write_Property(
case PROP_NUMBER_OF_APDU_RETRIES: case PROP_NUMBER_OF_APDU_RETRIES:
if (wp_data->value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) if (wp_data->value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT)
{ {
Device_Set_Number_Of_APDU_Retries(wp_data->value.type.Unsigned_Int); /* FIXME: bounds check? */
Device_Set_Number_Of_APDU_Retries((uint8_t)wp_data->value.type.Unsigned_Int);
status = true; status = true;
} }
else else
@@ -621,7 +622,8 @@ bool Device_Write_Property(
case PROP_APDU_TIMEOUT: case PROP_APDU_TIMEOUT:
if (wp_data->value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) if (wp_data->value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT)
{ {
Device_Set_APDU_Timeout(wp_data->value.type.Unsigned_Int); /* FIXME: bounds check? */
Device_Set_APDU_Timeout((uint16_t)wp_data->value.type.Unsigned_Int);
status = true; status = true;
} }
else else
@@ -634,7 +636,8 @@ bool Device_Write_Property(
case PROP_VENDOR_IDENTIFIER: case PROP_VENDOR_IDENTIFIER:
if (wp_data->value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) if (wp_data->value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT)
{ {
Device_Set_Vendor_Identifier(wp_data->value.type.Unsigned_Int); /* FIXME: bounds check? */
Device_Set_Vendor_Identifier((uint16_t)wp_data->value.type.Unsigned_Int);
status = true; status = true;
} }
else else
+2
View File
@@ -27,7 +27,9 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <time.h> /* for time */ #include <time.h> /* for time */
#include <errno.h>
#include "bactext.h" #include "bactext.h"
#include "iam.h" #include "iam.h"
#include "arf.h" #include "arf.h"
Binary file not shown.
+2 -2
View File
@@ -90,7 +90,7 @@ int iam_decode_service_request(
uint32_t object_instance = 0; uint32_t object_instance = 0;
uint8_t tag_number = 0; uint8_t tag_number = 0;
uint32_t len_value = 0; uint32_t len_value = 0;
unsigned int decoded_value = 0; uint32_t decoded_value = 0;
int decoded_integer = 0; int decoded_integer = 0;
// OBJECT ID - object id // OBJECT ID - object id
@@ -134,7 +134,7 @@ int iam_decode_service_request(
if (decoded_value > 0xFFFF) if (decoded_value > 0xFFFF)
return -1; return -1;
if (pVendor_id) if (pVendor_id)
*pVendor_id = decoded_value; *pVendor_id = (uint16_t)decoded_value;
return apdu_len; return apdu_len;
} }
Binary file not shown.
+47 -3
View File
@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c # ADD CPP /nologo /W3 /GX /O2 /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /I "c:\code\bacnet-stack\demo\object\\" /I "c:\code\bacnet-stack\demo\handler\\" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "BACDL_BIP" /FD /c
# SUBTRACT CPP /YX # SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG"
@@ -67,7 +67,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /I "c:\code\bacnet-stack\demo\object" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "BACDL_BIP" /FR /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "c:\code\bacnet-stack\demo\object" /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /I "c:\code\bacnet-stack\demo\object\\" /I "c:\code\bacnet-stack\demo\handler\\" /D "_DEBUG" /D "BACDL_BIP" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c
# SUBTRACT CPP /YX # SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG"
@@ -161,7 +161,31 @@ SOURCE=..\..\..\demo\object\device.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\handlers.c SOURCE=..\..\..\demo\handler\h_arf.c
# End Source File
# Begin Source File
SOURCE=..\..\..\demo\handler\h_arf_a.c
# End Source File
# Begin Source File
SOURCE=..\..\..\demo\handler\h_iam.c
# End Source File
# Begin Source File
SOURCE=..\..\..\demo\handler\h_rp.c
# End Source File
# Begin Source File
SOURCE=..\..\..\demo\handler\h_rp_a.c
# End Source File
# Begin Source File
SOURCE=..\..\..\demo\handler\h_whois.c
# End Source File
# Begin Source File
SOURCE=..\..\..\demo\handler\h_wp.c
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -177,6 +201,10 @@ SOURCE=..\main.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\demo\handler\noserv.c
# End Source File
# Begin Source File
SOURCE=..\..\..\npdu.c SOURCE=..\..\..\npdu.c
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -193,10 +221,26 @@ SOURCE=..\..\..\rp.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\demo\handler\s_rp.c
# End Source File
# Begin Source File
SOURCE=..\..\..\demo\handler\s_whois.c
# End Source File
# Begin Source File
SOURCE=..\..\..\demo\handler\s_wp.c
# End Source File
# Begin Source File
SOURCE=..\..\..\tsm.c SOURCE=..\..\..\tsm.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\demo\handler\txbuf.c
# End Source File
# Begin Source File
SOURCE=..\..\..\whois.c SOURCE=..\..\..\whois.c
# End Source File # End Source File
# Begin Source File # Begin Source File
Binary file not shown.
Binary file not shown.
+36 -83
View File
@@ -8,36 +8,8 @@
<h3>Command Lines</h3> <h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58A.tmp" with contents Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58A.tmp" with contents
[ [
/nologo /MLd /W3 /Gm /GX /ZI /Od /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /I "c:\code\bacnet-stack\demo\object" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "BACDL_BIP" /FR"Debug/" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c /nologo /MLd /W3 /Gm /GX /ZI /Od /I "c:\code\bacnet-stack\demo\object" /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /I "c:\code\bacnet-stack\demo\object\\" /I "c:\code\bacnet-stack\demo\handler\\" /D "_DEBUG" /D "BACDL_BIP" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR"Debug/" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
"C:\code\bacnet-stack\abort.c"
"C:\code\bacnet-stack\address.c"
"C:\code\bacnet-stack\apdu.c"
"C:\code\bacnet-stack\arf.c"
"C:\code\bacnet-stack\bacapp.c"
"C:\code\bacnet-stack\bacdcode.c"
"C:\code\bacnet-stack\bacerror.c"
"C:\code\bacnet-stack\bacstr.c"
"C:\code\bacnet-stack\bactext.c"
"C:\code\bacnet-stack\bigend.c"
"C:\code\bacnet-stack\ports\win32\bip-init.c"
"C:\code\bacnet-stack\bip.c"
"C:\code\bacnet-stack\crc.c"
"C:\code\bacnet-stack\datalink.c"
"C:\code\bacnet-stack\handlers.c"
"C:\code\bacnet-stack\iam.c"
"C:\code\bacnet-stack\indtext.c"
"C:\code\bacnet-stack\ports\win32\main.c" "C:\code\bacnet-stack\ports\win32\main.c"
"C:\code\bacnet-stack\npdu.c"
"C:\code\bacnet-stack\reject.c"
"C:\code\bacnet-stack\ringbuf.c"
"C:\code\bacnet-stack\rp.c"
"C:\code\bacnet-stack\tsm.c"
"C:\code\bacnet-stack\whois.c"
"C:\code\bacnet-stack\wp.c"
"C:\code\bacnet-stack\demo\object\device.c"
"C:\code\bacnet-stack\demo\object\ai.c"
"C:\code\bacnet-stack\demo\object\ao.c"
"C:\code\bacnet-stack\demo\object\bacfile.c"
] ]
Creating command line "cl.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58A.tmp" Creating command line "cl.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58A.tmp"
Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58B.tmp" with contents Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58B.tmp" with contents
@@ -45,11 +17,14 @@ Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58B.tmp" with conten
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/bacnet.pdb" /debug /machine:I386 /out:"Debug/bacnet.exe" /pdbtype:sept kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/bacnet.pdb" /debug /machine:I386 /out:"Debug/bacnet.exe" /pdbtype:sept
".\Debug\abort.obj" ".\Debug\abort.obj"
".\Debug\address.obj" ".\Debug\address.obj"
".\Debug\ai.obj"
".\Debug\ao.obj"
".\Debug\apdu.obj" ".\Debug\apdu.obj"
".\Debug\arf.obj" ".\Debug\arf.obj"
".\Debug\bacapp.obj" ".\Debug\bacapp.obj"
".\Debug\bacdcode.obj" ".\Debug\bacdcode.obj"
".\Debug\bacerror.obj" ".\Debug\bacerror.obj"
".\Debug\bacfile.obj"
".\Debug\bacstr.obj" ".\Debug\bacstr.obj"
".\Debug\bactext.obj" ".\Debug\bactext.obj"
".\Debug\bigend.obj" ".\Debug\bigend.obj"
@@ -57,7 +32,7 @@ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32
".\Debug\bip.obj" ".\Debug\bip.obj"
".\Debug\crc.obj" ".\Debug\crc.obj"
".\Debug\datalink.obj" ".\Debug\datalink.obj"
".\Debug\handlers.obj" ".\Debug\device.obj"
".\Debug\iam.obj" ".\Debug\iam.obj"
".\Debug\indtext.obj" ".\Debug\indtext.obj"
".\Debug\main.obj" ".\Debug\main.obj"
@@ -68,69 +43,39 @@ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32
".\Debug\tsm.obj" ".\Debug\tsm.obj"
".\Debug\whois.obj" ".\Debug\whois.obj"
".\Debug\wp.obj" ".\Debug\wp.obj"
".\Debug\device.obj" ".\Debug\s_rp.obj"
".\Debug\ai.obj" ".\Debug\s_whois.obj"
".\Debug\ao.obj" ".\Debug\s_wp.obj"
".\Debug\bacfile.obj" ".\Debug\txbuf.obj"
".\Debug\h_arf.obj"
".\Debug\h_arf_a.obj"
".\Debug\h_iam.obj"
".\Debug\h_rp.obj"
".\Debug\h_rp_a.obj"
".\Debug\h_whois.obj"
".\Debug\h_wp.obj"
".\Debug\noserv.obj"
] ]
Creating command line "link.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58B.tmp" Creating command line "link.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58B.tmp"
<h3>Output Window</h3> <h3>Output Window</h3>
Compiling... Compiling...
abort.c
address.c
apdu.c
arf.c
bacapp.c
bacdcode.c
bacerror.c
bacstr.c
bactext.c
bigend.c
bip-init.c
bip.c
crc.c
datalink.c
handlers.c
iam.c
indtext.c
main.c main.c
c:\code\bacnet-stack\ports\win32\net.h(30) : warning C4005: 'STRICT' : macro redefinition c:\code\bacnet-stack\ports\win32\net.h(30) : warning C4005: 'STRICT' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\windef.h(15) : see previous definition of 'STRICT' c:\program files\microsoft visual studio\vc98\include\windef.h(15) : see previous definition of 'STRICT'
npdu.c
reject.c
Generating Code...
c:\code\bacnet-stack\npdu.c(332) : warning C4761: integral size mismatch in argument; conversion supplied
c:\code\bacnet-stack\handlers.c(194) : warning C4761: integral size mismatch in argument; conversion supplied
c:\code\bacnet-stack\handlers.c(271) : warning C4761: integral size mismatch in argument; conversion supplied
Compiling...
ringbuf.c
rp.c
tsm.c
whois.c
wp.c
device.c
ai.c
c:\code\bacnet-stack\demo\object\ai.c(76) : warning C4305: 'initializing' : truncation from 'const double ' to 'float '
ao.c
c:\code\bacnet-stack\demo\object\ao.c(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'float '
bacfile.c
Generating Code...
c:\code\bacnet-stack\demo\object\bacfile.c(285) : warning C4761: integral size mismatch in argument; conversion supplied
c:\code\bacnet-stack\demo\object\device.c(611) : warning C4761: integral size mismatch in argument; conversion supplied
c:\code\bacnet-stack\demo\object\device.c(624) : warning C4761: integral size mismatch in argument; conversion supplied
c:\code\bacnet-stack\demo\object\device.c(637) : warning C4761: integral size mismatch in argument; conversion supplied
c:\code\bacnet-stack\wp.c(129) : warning C4761: integral size mismatch in argument; conversion supplied
Linking... Linking...
Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58D.tmp" with contents Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58C.tmp" with contents
[ [
/nologo /o"Debug/bacnet.bsc" /nologo /o"Debug/bacnet.bsc"
".\Debug\abort.sbr" ".\Debug\abort.sbr"
".\Debug\address.sbr" ".\Debug\address.sbr"
".\Debug\ai.sbr"
".\Debug\ao.sbr"
".\Debug\apdu.sbr" ".\Debug\apdu.sbr"
".\Debug\arf.sbr" ".\Debug\arf.sbr"
".\Debug\bacapp.sbr" ".\Debug\bacapp.sbr"
".\Debug\bacdcode.sbr" ".\Debug\bacdcode.sbr"
".\Debug\bacerror.sbr" ".\Debug\bacerror.sbr"
".\Debug\bacfile.sbr"
".\Debug\bacstr.sbr" ".\Debug\bacstr.sbr"
".\Debug\bactext.sbr" ".\Debug\bactext.sbr"
".\Debug\bigend.sbr" ".\Debug\bigend.sbr"
@@ -138,7 +83,7 @@ Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58D.tmp" with conten
".\Debug\bip.sbr" ".\Debug\bip.sbr"
".\Debug\crc.sbr" ".\Debug\crc.sbr"
".\Debug\datalink.sbr" ".\Debug\datalink.sbr"
".\Debug\handlers.sbr" ".\Debug\device.sbr"
".\Debug\iam.sbr" ".\Debug\iam.sbr"
".\Debug\indtext.sbr" ".\Debug\indtext.sbr"
".\Debug\main.sbr" ".\Debug\main.sbr"
@@ -149,18 +94,26 @@ Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58D.tmp" with conten
".\Debug\tsm.sbr" ".\Debug\tsm.sbr"
".\Debug\whois.sbr" ".\Debug\whois.sbr"
".\Debug\wp.sbr" ".\Debug\wp.sbr"
".\Debug\device.sbr" ".\Debug\s_rp.sbr"
".\Debug\ai.sbr" ".\Debug\s_whois.sbr"
".\Debug\ao.sbr" ".\Debug\s_wp.sbr"
".\Debug\bacfile.sbr"] ".\Debug\txbuf.sbr"
Creating command line "bscmake.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58D.tmp" ".\Debug\h_arf.sbr"
".\Debug\h_arf_a.sbr"
".\Debug\h_iam.sbr"
".\Debug\h_rp.sbr"
".\Debug\h_rp_a.sbr"
".\Debug\h_whois.sbr"
".\Debug\h_wp.sbr"
".\Debug\noserv.sbr"]
Creating command line "bscmake.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58C.tmp"
Creating browse info file... Creating browse info file...
<h3>Output Window</h3> <h3>Output Window</h3>
<h3>Results</h3> <h3>Results</h3>
bacnet.exe - 0 error(s), 11 warning(s) bacnet.exe - 0 error(s), 1 warning(s)
</pre> </pre>
</body> </body>
</html> </html>
+6
View File
@@ -85,6 +85,12 @@ static void cleanup(void)
WSACleanup(); WSACleanup();
} }
void bip_set_interface(char *ifname)
{
(void)ifname;
/* dummy function */
}
bool bip_init(void) bool bip_init(void)
{ {
int rv = 0; // return from socket lib calls int rv = 0; // return from socket lib calls
+12 -8
View File
@@ -24,7 +24,7 @@
*********************************************************************/ *********************************************************************/
// This is one way to use the embedded BACnet stack under Win32 // This is one way to use the embedded BACnet stack under Win32
// compiled with Borland C++ 5.02 // compiled with Borland C++ 5.02 or Visual C++ 6.0
#include <winsock2.h> #include <winsock2.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
@@ -38,10 +38,14 @@
#include "apdu.h" #include "apdu.h"
#include "device.h" #include "device.h"
#include "handlers.h" #include "handlers.h"
#include "client.h"
#include "datalink.h" #include "datalink.h"
#include "txbuf.h"
// buffer used for receive // buffer used for receive
static uint8_t Rx_Buf[MAX_MPDU] = {0}; static uint8_t Rx_Buf[MAX_MPDU] = {0};
/* send a whois to see who is on the network */
static bool Who_Is_Request = true;
static void Read_Properties(void) static void Read_Properties(void)
{ {
@@ -164,7 +168,7 @@ static void Init_Service_Handlers(void)
// we need to handle who-is to support dynamic device binding // we need to handle who-is to support dynamic device binding
apdu_set_unconfirmed_handler( apdu_set_unconfirmed_handler(
SERVICE_UNCONFIRMED_WHO_IS, SERVICE_UNCONFIRMED_WHO_IS,
WhoIsHandler); handler_who_is);
apdu_set_unconfirmed_handler( apdu_set_unconfirmed_handler(
SERVICE_UNCONFIRMED_I_AM, SERVICE_UNCONFIRMED_I_AM,
LocalIAmHandler); LocalIAmHandler);
@@ -172,18 +176,18 @@ static void Init_Service_Handlers(void)
// set the handler for all the services we don't implement // set the handler for all the services we don't implement
// It is required to send the proper reject message... // It is required to send the proper reject message...
apdu_set_unrecognized_service_handler_handler( apdu_set_unrecognized_service_handler_handler(
UnrecognizedServiceHandler); handler_unrecognized_service);
// we must implement read property - it's required! // we must implement read property - it's required!
apdu_set_confirmed_handler( apdu_set_confirmed_handler(
SERVICE_CONFIRMED_READ_PROPERTY, SERVICE_CONFIRMED_READ_PROPERTY,
ReadPropertyHandler); handler_read_property);
apdu_set_confirmed_handler( apdu_set_confirmed_handler(
SERVICE_CONFIRMED_WRITE_PROPERTY, SERVICE_CONFIRMED_WRITE_PROPERTY,
WritePropertyHandler); handler_write_property);
// handle the data coming back from confirmed requests // handle the data coming back from confirmed requests
apdu_set_confirmed_ack_handler( apdu_set_confirmed_ack_handler(
SERVICE_CONFIRMED_READ_PROPERTY, SERVICE_CONFIRMED_READ_PROPERTY,
ReadPropertyAckHandler); handler_read_property_ack);
} }
static void print_address( static void print_address(
@@ -274,11 +278,11 @@ int main(int argc, char *argv[])
if (I_Am_Request) if (I_Am_Request)
{ {
I_Am_Request = false; I_Am_Request = false;
Send_IAm(); iam_send(&Handler_Transmit_Buffer[0]);
} else if (Who_Is_Request) } else if (Who_Is_Request)
{ {
Who_Is_Request = false; Who_Is_Request = false;
Send_WhoIs(); Send_WhoIs(-1,-1);
} }
else else
{ {
+2 -2
View File
@@ -82,7 +82,7 @@ int rp_decode_service_request(
uint32_t len_value_type = 0; uint32_t len_value_type = 0;
int type = 0; // for decoding int type = 0; // for decoding
int property = 0; // for decoding int property = 0; // for decoding
unsigned array_value = 0; // for decoding uint32_t array_value = 0; // for decoding
// check for value pointers // check for value pointers
if (apdu_len && data) if (apdu_len && data)
@@ -198,7 +198,7 @@ int rp_ack_decode_service_request(
int tag_len = 0; // length of tag decode int tag_len = 0; // length of tag decode
int len = 0; // total length of decodes int len = 0; // total length of decodes
int object = 0, property = 0; // for decoding int object = 0, property = 0; // for decoding
unsigned array_value = 0; // for decoding uint32_t array_value = 0; // for decoding
// FIXME: check apdu_len against the len during decode // FIXME: check apdu_len against the len during decode
// Tag 0: Object ID // Tag 0: Object ID
+2 -2
View File
@@ -164,7 +164,7 @@ int rpm_decode_object_property(
uint8_t tag_number = 0; uint8_t tag_number = 0;
uint32_t len_value_type = 0; uint32_t len_value_type = 0;
int property = 0; /* for decoding */ int property = 0; /* for decoding */
unsigned array_value = 0; /* for decoding */ uint32_t array_value = 0; /* for decoding */
/* check for valid pointers */ /* check for valid pointers */
if (apdu && apdu_len && object_property && array_index) if (apdu && apdu_len && object_property && array_index)
@@ -396,7 +396,7 @@ int rpm_ack_decode_object_property(
uint8_t tag_number = 0; uint8_t tag_number = 0;
uint32_t len_value_type = 0; uint32_t len_value_type = 0;
int property = 0; /* for decoding */ int property = 0; /* for decoding */
unsigned array_value = 0; /* for decoding */ uint32_t array_value = 0; /* for decoding */
/* check for valid pointers */ /* check for valid pointers */
if (apdu && apdu_len && object_property && array_index) if (apdu && apdu_len && object_property && array_index)
+1 -1
View File
@@ -79,7 +79,7 @@ int whois_decode_service_request(
int len = 0; int len = 0;
uint8_t tag_number = 0; uint8_t tag_number = 0;
uint32_t len_value = 0; uint32_t len_value = 0;
unsigned int decoded_value = 0; uint32_t decoded_value = 0;
// optional limits - must be used as a pair // optional limits - must be used as a pair
if (apdu_len) if (apdu_len)
+3 -2
View File
@@ -88,7 +88,7 @@ int wp_decode_service_request(
uint32_t len_value_type = 0; uint32_t len_value_type = 0;
int type = 0; // for decoding int type = 0; // for decoding
int property = 0; // for decoding int property = 0; // for decoding
unsigned unsigned_value = 0; uint32_t unsigned_value = 0;
// check for value pointers // check for value pointers
if (apdu_len && data) if (apdu_len && data)
@@ -143,7 +143,8 @@ int wp_decode_service_request(
{ {
len += tag_len; len += tag_len;
len = decode_unsigned(&apdu[len], len_value_type, &unsigned_value); len = decode_unsigned(&apdu[len], len_value_type, &unsigned_value);
data->priority = unsigned_value; /* FIXME: bounds check */
data->priority = (uint8_t)unsigned_value;
} }
} }
} }