Import ubuscpp
domod
This commit is contained in:
61
lib/ubuscpp/src/UBusObject.cpp
Normal file
61
lib/ubuscpp/src/UBusObject.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
/*!
|
||||
* (C) Copyright 2003-2015 Awox SA. All rights reserved.
|
||||
* This work contains confidential trade secrets of Awox.
|
||||
* Use, examination, copying, transfer and disclosure to others
|
||||
* are prohibited, except with the express written agreement of Awox.
|
||||
*
|
||||
* @Author: Awox
|
||||
* @Date: 06/10/2014
|
||||
*/
|
||||
|
||||
|
||||
/*------------------------------- INCLUDES ----------------------------------*/
|
||||
|
||||
#include "ubuscpp/UBusObject.h"
|
||||
|
||||
/*------------------------------- GLOBALS ----------------------------------*/
|
||||
|
||||
/*--------------------------------- DEFINES ---------------------------------*/
|
||||
|
||||
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn awUBusObject
|
||||
*
|
||||
* @brief Construct a new awUBusObject, the object type and methods is
|
||||
* provided statically using the type Derived
|
||||
*
|
||||
* @param anObjType object type, be carreful it should not be a temporary !!!
|
||||
* @param AnObjName : the name of the object
|
||||
* @param anObjID : TO BE DEFINED
|
||||
* @param anObjPath : TO BE DEFINED
|
||||
*
|
||||
* @important : the parameter anObjType should not be a temporary !!!
|
||||
*/
|
||||
UBusObject::UBusObject (ubus_object_type &anObjType, const char *AnObjName, int anObjID,
|
||||
const char *anObjPath)
|
||||
{
|
||||
name = AnObjName ? strdup (AnObjName) : 0;
|
||||
id = anObjID;
|
||||
path = anObjPath ? strdup (anObjPath) : 0;
|
||||
|
||||
type = &anObjType;
|
||||
methods = anObjType.methods;
|
||||
n_methods = anObjType.n_methods;
|
||||
|
||||
// nullify last fields
|
||||
subscribe_cb = 0;
|
||||
has_subscribers = false;
|
||||
}
|
||||
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn ~UBusObject
|
||||
*
|
||||
* @brief Destructor of the UBusObject
|
||||
*/
|
||||
UBusObject::~UBusObject (void)
|
||||
{
|
||||
free ((char*)name);
|
||||
free ((char*)path);
|
||||
}
|
||||
Reference in New Issue
Block a user