AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/demo/gateway/main.c
static void Init_Service_Handlers(
    uint32_t first_object_instance)
{
    Device_Init(NULL);
    Routing_Device_Init(first_object_instance);

    /* we need to handle who-is to support dynamic device binding
     * For the gateway, we will use the unicast variety so we can
     * get back through switches to different subnets.
     * Don't need the routed versions, since the npdu handler calls
     * each device in turn.
     */
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS,
        handler_who_is_unicast);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_HAS, handler_who_has);
    /* set the handler for all the services we don't implement */
    /* It is required to send the proper reject message... */
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    /* Set the handlers for any confirmed services that we support. */
    /* We must implement read property - it's required! */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
        handler_read_property_multiple);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
        handler_write_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
        handler_read_range);
#if defined(BACFILE)
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
        handler_atomic_read_file);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_WRITE_FILE,
        handler_atomic_write_file);
#endif
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
        handler_reinitialize_device);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION,
        handler_timesync_utc);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION,
        handler_timesync);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV,
        handler_cov_subscribe);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_COV_NOTIFICATION,
        handler_ucov_notification);
    /* handle communication so we can shutup when asked */
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
        handler_device_communication_control);
}
/** Initialize the handlers we will utilize.
 * @see Device_Init, apdu_set_unconfirmed_handler, apdu_set_confirmed_handler
 */
Initialize the handlers we will utilize.
Initialize the handlers we will utilize .
static void Init_Service_Handlers(
    uint32_t first_object_instance)
{
    Device_Init(NULL);
    Routing_Device_Init(first_object_instance);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS,
        handler_who_is_unicast);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_HAS, handler_who_has);
    apdu_set_unrecognized_service_handler_handler
        (handler_unrecognized_service);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROPERTY,
        handler_read_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
        handler_read_property_multiple);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
        handler_write_property);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
        handler_read_range);
#if defined(BACFILE)
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
        handler_atomic_read_file);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_WRITE_FILE,
        handler_atomic_write_file);
#endif
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_REINITIALIZE_DEVICE,
        handler_reinitialize_device);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION,
        handler_timesync_utc);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION,
        handler_timesync);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_SUBSCRIBE_COV,
        handler_cov_subscribe);
    apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_COV_NOTIFICATION,
        handler_ucov_notification);
    apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
        handler_device_communication_control);
}
static void Init_Service_Handlers ( uint32_t first_object_instance ) { Device_Init ( NULL ) ; Routing_Device_Init ( first_object_instance ) ; apdu_set_unconfirmed_handler ( SERVICE_UNCONFIRMED_WHO_IS , handler_who_is_unicast ) ; apdu_set_unconfirmed_handler ( SERVICE_UNCONFIRMED_WHO_HAS , handler_who_has ) ; apdu_set_unrecognized_service_handler_handler ( handler_unrecognized_service ) ; apdu_set_confirmed_handler ( SERVICE_CONFIRMED_READ_PROPERTY , handler_read_property ) ; apdu_set_confirmed_handler ( SERVICE_CONFIRMED_READ_PROP_MULTIPLE , handler_read_property_multiple ) ; apdu_set_confirmed_handler ( SERVICE_CONFIRMED_WRITE_PROPERTY , handler_write_property ) ; apdu_set_confirmed_handler ( SERVICE_CONFIRMED_READ_RANGE , handler_read_range ) ; #if defined ( BACFILE ) apdu_set_confirmed_handler ( SERVICE_CONFIRMED_ATOMIC_READ_FILE , handler_atomic_read_file ) ; apdu_set_confirmed_handler ( SERVICE_CONFIRMED_ATOMIC_WRITE_FILE , handler_atomic_write_file ) ; #endif apdu_set_confirmed_handler ( SERVICE_CONFIRMED_REINITIALIZE_DEVICE , handler_reinitialize_device ) ; apdu_set_unconfirmed_handler ( SERVICE_UNCONFIRMED_UTC_TIME_SYNCHRONIZATION , handler_timesync_utc ) ; apdu_set_unconfirmed_handler ( SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION , handler_timesync ) ; apdu_set_confirmed_handler ( SERVICE_CONFIRMED_SUBSCRIBE_COV , handler_cov_subscribe ) ; apdu_set_unconfirmed_handler ( SERVICE_UNCONFIRMED_COV_NOTIFICATION , handler_ucov_notification ) ; apdu_set_confirmed_handler ( SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL , handler_device_communication_control ) ; }
Initialize the handlers we will utilize.
Initialize the handlers we will utilize .
/* we need to handle who-is to support dynamic device binding
     * For the gateway, we will use the unicast variety so we can
     * get back through switches to different subnets.
     * Don't need the routed versions, since the npdu handler calls
     * each device in turn.
     */ /* set the handler for all the services we don't implement */ /* It is required to send the proper reject message... */ /* Set the handlers for any confirmed services that we support. */ /* We must implement read property - it's required! */ /* handle communication so we can shutup when asked */