Exemplo n.º 1
0
void testBACnetLightingCommand(
    Test * pTest,
    BACNET_LIGHTING_COMMAND *data)
{
    bool status = false;
    BACNET_LIGHTING_COMMAND test_data;
    int len, apdu_len;
    uint8_t apdu[MAX_APDU] = {0};

    status = lighting_command_copy(&test_data, NULL);
    ct_test(pTest, status == false);
    status = lighting_command_copy(NULL, data);
    ct_test(pTest, status == false);
    status = lighting_command_copy(&test_data, data);
    ct_test(pTest, status == true);
    status = lighting_command_same(&test_data, data);
    ct_test(pTest, status == true);
    len = lighting_command_encode(apdu, data);
    apdu_len = lighting_command_decode(apdu, sizeof(apdu), &test_data);
    ct_test(pTest, len > 0);
    ct_test(pTest, apdu_len > 0);
    status = lighting_command_same(&test_data, data);
}
Exemplo n.º 2
0
/**
 * For a given object instance-number, gets the lighting-command.
 *
 * @param object_instance - object-instance number of the object
 * @param value - holds the lighting command value
 *
 * @return true if lighting command was retrieved
 */
bool Lighting_Output_Lighting_Command(
    uint32_t object_instance,
    BACNET_LIGHTING_COMMAND *value)
{
    bool status = false;
    unsigned index = 0;

    index = Lighting_Output_Instance_To_Index(object_instance);
    if (index < MAX_LIGHTING_OUTPUTS) {
        status = lighting_command_copy(value,
            &Lighting_Output[index].Lighting_Command);
    }

    return status;
}
Exemplo n.º 3
0
/**
 * For a given object instance-number, sets the lighting-command.
 *
 * @param object_instance - object-instance number of the object
 * @param value - holds the lighting command value
 *
 * @return  true if lighting command was set
 */
bool Lighting_Output_Lighting_Command_Set(
    uint32_t object_instance,
    BACNET_LIGHTING_COMMAND *value)
{
    bool status = false;
    unsigned index = 0;

    index = Lighting_Output_Instance_To_Index(object_instance);
    if (index < MAX_LIGHTING_OUTPUTS) {
        // FIXME: check lighting command member values
        status = lighting_command_copy(
            &Lighting_Output[index].Lighting_Command,
            value);
        // FIXME: set all the other values, and get the light levels moving
    }

    return status;
}