static void MyErrorHandler( BACNET_ADDRESS * src, uint8_t invoke_id, BACNET_ERROR_CLASS error_class, BACNET_ERROR_CODE error_code) { /* FIXME: verify src and invoke id */ (void) src; (void) invoke_id; printf("BACnet Error: %s: %s\r\n", bactext_error_class_name(error_class), bactext_error_code_name(error_code)); Error_Detected = true; }
static void MyErrorHandler( BACNET_ADDRESS * src, uint8_t invoke_id, BACNET_ERROR_CLASS error_class, BACNET_ERROR_CODE error_code) { if (address_match(&Target_Address, src) && (invoke_id == Request_Invoke_ID)) { printf("BACnet Error: %s: %s\r\n", bactext_error_class_name((int) error_class), bactext_error_code_name((int) error_code)); Error_Detected = true; } }
static void Atomic_Read_File_Error_Handler( BACNET_ADDRESS * src, uint8_t invoke_id, BACNET_ERROR_CLASS error_class, BACNET_ERROR_CODE error_code) { /* FIXME: verify src and invoke id */ (void) src; (void) invoke_id; printf("\r\nBACnet Error!\r\n"); printf("Error Class: %s\r\n", bactext_error_class_name(error_class)); printf("Error Code: %s\r\n", bactext_error_code_name(error_code)); Error_Detected = true; }
static void Atomic_Write_File_Error_Handler( BACNET_ADDRESS * src, uint8_t invoke_id, BACNET_ERROR_CLASS error_class, BACNET_ERROR_CODE error_code) { if (address_match(&Target_Address, src) && (invoke_id == Current_Invoke_ID)) { printf("\r\nBACnet Error!\r\n"); printf("Error Class: %s\r\n", bactext_error_class_name(error_class)); printf("Error Code: %s\r\n", bactext_error_code_name(error_code)); Error_Detected = true; } }
static void My_Error_Handler( BACNET_ADDRESS * src, uint8_t invoke_id, BACNET_ERROR_CLASS error_class, BACNET_ERROR_CODE error_code) { if (address_match(&Target_Address, src) && (invoke_id == Request_Invoke_ID)) { char msg[MAX_ERROR_STRING]; sprintf(msg, "BACnet Error: %s: %s", bactext_error_class_name((int) error_class), bactext_error_code_name((int) error_code)); LogError(msg); } }
void rpm_ack_extract_data( BACNET_READ_ACCESS_DATA * rpm_data) { BACNET_OBJECT_PROPERTY_VALUE object_value; /* for bacapp printing */ BACNET_PROPERTY_REFERENCE *listOfProperties; BACNET_APPLICATION_DATA_VALUE *value; bool array_value = false; char ackString[MAX_ACK_STRING] = ""; char *pAckString = &ackString[0]; if (rpm_data) { listOfProperties = rpm_data->listOfProperties; while (listOfProperties) { value = listOfProperties->value; if (value) { if (value->next) { strncat(pAckString, "{", 1); pAckString++; array_value = true; } else { array_value = false; } object_value.object_type = rpm_data->object_type; object_value.object_instance = rpm_data->object_instance; while (value) { object_value.object_property = listOfProperties->propertyIdentifier; object_value.array_index = listOfProperties->propertyArrayIndex; object_value.value = value; bacapp_snprintf_value(pAckString, MAX_ACK_STRING - (pAckString - ackString), &object_value); if (value->next) { strncat(pAckString, ",", 1); pAckString++; } else { if (array_value) { strncat(pAckString, "}", 1); pAckString++; } } value = value->next; } } else { /* AccessError */ sprintf(ackString, "BACnet Error: %s: %s", bactext_error_class_name((int) listOfProperties-> error.error_class), bactext_error_code_name((int) listOfProperties-> error.error_code)); LogError(ackString); } listOfProperties = listOfProperties->next; /* Add a separator between consecutive entries so that Perl can */ /* parse this out */ strncat(pAckString, "QQQ", 3); pAckString += 3; } /* Now let's call a Perl function to display the data */ __LogAnswer(ackString, 1); } }
/* for debugging... */ void rpm_ack_print_data( BACNET_READ_ACCESS_DATA * rpm_data) { BACNET_OBJECT_PROPERTY_VALUE object_value; /* for bacapp printing */ BACNET_PROPERTY_REFERENCE *listOfProperties; BACNET_APPLICATION_DATA_VALUE *value; bool array_value = false; if (rpm_data) { #if PRINT_ENABLED fprintf(stdout, "%s #%lu\r\n", bactext_object_type_name(rpm_data->object_type), (unsigned long) rpm_data->object_instance); fprintf(stdout, "{\r\n"); #endif listOfProperties = rpm_data->listOfProperties; while (listOfProperties) { #if PRINT_ENABLED if (listOfProperties->propertyIdentifier < 512) { fprintf(stdout, " %s: ", bactext_property_name(listOfProperties-> propertyIdentifier)); } else { fprintf(stdout, " proprietary %u: ", (unsigned) listOfProperties->propertyIdentifier); } #endif if (listOfProperties->propertyArrayIndex != BACNET_ARRAY_ALL) { #if PRINT_ENABLED fprintf(stdout, "[%d]", listOfProperties->propertyArrayIndex); #endif } value = listOfProperties->value; if (value) { #if PRINT_ENABLED if (value->next) { fprintf(stdout, "{"); array_value = true; } else { array_value = false; } #endif object_value.object_type = rpm_data->object_type; object_value.object_instance = rpm_data->object_instance; while (value) { object_value.object_property = listOfProperties->propertyIdentifier; object_value.array_index = listOfProperties->propertyArrayIndex; object_value.value = value; bacapp_print_value(stdout, &object_value); #if PRINT_ENABLED if (value->next) { fprintf(stdout, ",\r\n "); } else { if (array_value) { fprintf(stdout, "}\r\n"); } else { fprintf(stdout, "\r\n"); } } #endif value = value->next; } } else { #if PRINT_ENABLED /* AccessError */ fprintf(stdout, "BACnet Error: %s: %s\r\n", bactext_error_class_name((int) listOfProperties-> error.error_class), bactext_error_code_name((int) listOfProperties-> error.error_code)); #endif } listOfProperties = listOfProperties->next; } #if PRINT_ENABLED fprintf(stdout, "}\r\n"); #endif } }