• JsonTypes
  • JsonTypes Class

    (nymeaserver::JsonTypes)

    This class represents the types for the JSON-RPC API. More...

    Header: #include <JsonTypes>

    Public Types

    enum BasicType { Uuid, String, Int, Uint, ..., Object }

    Public Functions

    DECLARE_TYPE(basicType)

    Static Public Members

    QVariantMap allTypes()
    QString basicTypeToString(const QVariant::Type & type)
    QVariantMap packAction(const Action & action)
    QVariantMap packActionType(const ActionType & actionType)
    QVariantList packActionTypes(const DeviceClass & deviceClass)
    QVariantMap packBasicConfiguration()
    QVariantMap packCalendarItem(const CalendarItem & calendarItem)
    QVariantList packConfiguredDevices()
    QVariantList packCreateMethods(DeviceClass::CreateMethods createMethods)
    QVariantMap packDevice(Device * device)
    QVariantMap packDeviceClass(const DeviceClass & deviceClass)
    QVariantMap packDeviceDescriptor(const DeviceDescriptor & descriptor)
    QVariantList packDeviceDescriptors(const QList<DeviceDescriptor> deviceDescriptors)
    QVariantList packDeviceStates(Device * device)
    QVariantMap packEvent(const Event & event)
    QVariantMap packEventDescriptor(const EventDescriptor & eventDescriptor)
    QVariantList packEventTypes(const DeviceClass & deviceClass)
    QVariantMap packLogEntry(const LogEntry & logEntry)
    QVariantMap packParam(const Param & param)
    QVariantMap packParamDescriptor(const ParamDescriptor & paramDescriptor)
    QVariantMap packParamType(const ParamType & paramType)
    QVariantMap packPlugin(DevicePlugin * plugin)
    QVariantList packPlugins()
    QVariantMap packRepeatingOption(const RepeatingOption & option)
    QVariantMap packRule(const Rule & rule)
    QVariantMap packRuleAction(const RuleAction & ruleAction)
    QVariantMap packRuleActionParam(const RuleActionParam & ruleActionParam)
    QVariantMap packRuleDescription(const Rule & rule)
    QVariantList packRuleDescriptions()
    QVariantList packRuleDescriptions(const QList<Rule> & rules)
    QVariantList packRules(const QList<Rule> rules)
    QVariantMap packServerConfiguration(const ServerConfiguration & config)
    QVariantMap packState(const State & state)
    QVariantMap packStateDescriptor(const StateDescriptor & stateDescriptor)
    QVariantMap packStateEvaluator(const StateEvaluator & stateEvaluator)
    QVariantMap packStateType(const StateType & stateType)
    QVariantList packStateTypes(const DeviceClass & deviceClass)
    QVariantList packSupportedDevices(const VendorId & vendorId)
    QVariantList packSupportedVendors()
    QVariantMap packTag(const Tag & tag)
    QVariantMap packTimeDescriptor(const TimeDescriptor & timeDescriptor)
    QVariantMap packTimeEventItem(const TimeEventItem & timeEventItem)
    QVariantMap packTokenInfo(const TokenInfo & tokenInfo)
    QVariantMap packVendor(const Vendor & vendor)
    QVariantMap packWebServerConfiguration(const WebServerConfiguration & config)
    QVariantMap packWiredNetworkDevice(WiredNetworkDevice * networkDevice)
    QVariantMap packWirelessAccessPoint(WirelessAccessPoint * wirelessAccessPoint)
    QVariantMap packWirelessNetworkDevice(WirelessNetworkDevice * networkDevice)
    CalendarItem unpackCalendarItem(const QVariantMap & calendarItemMap)
    EventDescriptor unpackEventDescriptor(const QVariantMap & eventDescriptorMap)
    LogFilter unpackLogFilter(const QVariantMap & logFilterMap)
    Param unpackParam(const QVariantMap & paramMap)
    ParamDescriptor unpackParamDescriptor(const QVariantMap & paramMap)
    QList<ParamDescriptor> unpackParamDescriptors(const QVariantList & paramList)
    ParamList unpackParams(const QVariantList & paramList)
    RepeatingOption unpackRepeatingOption(const QVariantMap & repeatingOptionMap)
    Rule unpackRule(const QVariantMap & ruleMap)
    RuleAction unpackRuleAction(const QVariantMap & ruleActionMap)
    RuleActionParam unpackRuleActionParam(const QVariantMap & ruleActionParamMap)
    RuleActionParamList unpackRuleActionParams(const QVariantList & ruleActionParamList)
    ServerConfiguration unpackServerConfiguration(const QVariantMap & serverConfigurationMap)
    StateDescriptor unpackStateDescriptor(const QVariantMap & stateDescriptorMap)
    StateEvaluator unpackStateEvaluator(const QVariantMap & stateEvaluatorMap)
    Tag unpackTag(const QVariantMap & tagMap)
    TimeDescriptor unpackTimeDescriptor(const QVariantMap & timeDescriptorMap)
    TimeEventItem unpackTimeEventItem(const QVariantMap & timeEventItemMap)
    WebServerConfiguration unpackWebServerConfiguration(const QVariantMap & webServerConfigurationMap)
    QPair<bool, QString> validateBasicType(const QVariant & variant)
    QPair<bool, QString> validateEnum(const QVariantList & enumDescription, const QVariant & value)
    QPair<bool, QString> validateList(const QVariantList & templateList, const QVariantList & list)
    QPair<bool, QString> validateMap(const QVariantMap & templateMap, const QVariantMap & map)
    QPair<bool, QString> validateProperty(const QVariant & templateValue, const QVariant & value)
    QPair<bool, QString> validateVariant(const QVariant & templateVariant, const QVariant & variant)

    Detailed Description

    This class represents the types for the JSON-RPC API.

    This class represents all JSON-RPC API types and allows to transform Json objects into c++ objects and vers visa.

    Member Type Documentation

    enum JsonTypes::BasicType

    This enum type specifies the basic types of a JSON RPC API.

    ConstantValue
    nymeaserver::JsonTypes::Uuid0
    nymeaserver::JsonTypes::String1
    nymeaserver::JsonTypes::Int2
    nymeaserver::JsonTypes::Uint3
    nymeaserver::JsonTypes::Double4
    nymeaserver::JsonTypes::Bool5
    nymeaserver::JsonTypes::Variant6
    nymeaserver::JsonTypes::Color7
    nymeaserver::JsonTypes::Time8
    nymeaserver::JsonTypes::Object9

    Member Function Documentation

    JsonTypes::DECLARE_TYPE(basicType)

    [static] QVariantMap JsonTypes::allTypes()

    Returns a map containing all API types.

    [static] QString JsonTypes::basicTypeToString(const QVariant::Type & type)

    Returns the type string for the given type.

    [static] QVariantMap JsonTypes::packAction(const Action & action)

    Returns a variant map of the given action.

    [static] QVariantMap JsonTypes::packActionType(const ActionType & actionType)

    Returns a variant map of the given actionType.

    [static] QVariantList JsonTypes::packActionTypes(const DeviceClass & deviceClass)

    Returns a variant list of action types for the given deviceClass.

    [static] QVariantMap JsonTypes::packBasicConfiguration()

    Returns a variant map with the current basic configuration of the server.

    [static] QVariantMap JsonTypes::packCalendarItem(const CalendarItem & calendarItem)

    Returns a variant map of the given calendarItem.

    [static] QVariantList JsonTypes::packConfiguredDevices()

    Returns a variant list of configured devices.

    [static] QVariantList JsonTypes::packCreateMethods(DeviceClass::CreateMethods createMethods)

    Returns a variant list of the given createMethods.

    [static] QVariantMap JsonTypes::packDevice(Device * device)

    Returns a variant map of the given device.

    [static] QVariantMap JsonTypes::packDeviceClass(const DeviceClass & deviceClass)

    Returns a variant map of the given deviceClass.

    [static] QVariantMap JsonTypes::packDeviceDescriptor(const DeviceDescriptor & descriptor)

    Returns a variant map of the given descriptor.

    [static] QVariantList JsonTypes::packDeviceDescriptors(const QList<DeviceDescriptor> deviceDescriptors)

    Returns a variant list of the given deviceDescriptors.

    [static] QVariantList JsonTypes::packDeviceStates(Device * device)

    Returns a variant list of States from the given device.

    [static] QVariantMap JsonTypes::packEvent(const Event & event)

    Returns a variant map of the given event.

    [static] QVariantMap JsonTypes::packEventDescriptor(const EventDescriptor & eventDescriptor)

    Returns a variant map of the given eventDescriptor.

    [static] QVariantList JsonTypes::packEventTypes(const DeviceClass & deviceClass)

    Returns a variant list of event types for the given deviceClass.

    [static] QVariantMap JsonTypes::packLogEntry(const LogEntry & logEntry)

    Returns a variant map of the given logEntry.

    [static] QVariantMap JsonTypes::packParam(const Param & param)

    Returns a variant map of the given param.

    [static] QVariantMap JsonTypes::packParamDescriptor(const ParamDescriptor & paramDescriptor)

    Returns a variant map of the given paramDescriptor.

    [static] QVariantMap JsonTypes::packParamType(const ParamType & paramType)

    Returns a variant map of the given paramType.

    [static] QVariantMap JsonTypes::packPlugin(DevicePlugin * plugin)

    Returns a variant map of the given plugin.

    [static] QVariantList JsonTypes::packPlugins()

    Returns a variant list containing all plugins.

    [static] QVariantMap JsonTypes::packRepeatingOption(const RepeatingOption & option)

    Returns a variant map of the given option.

    [static] QVariantMap JsonTypes::packRule(const Rule & rule)

    Returns a variant map of the given rule.

    [static] QVariantMap JsonTypes::packRuleAction(const RuleAction & ruleAction)

    Returns a variant map of the given ruleAction.

    [static] QVariantMap JsonTypes::packRuleActionParam(const RuleActionParam & ruleActionParam)

    Returns a variant map of the given ruleActionParam.

    [static] QVariantMap JsonTypes::packRuleDescription(const Rule & rule)

    Returns a variant map of the given rule.

    [static] QVariantList JsonTypes::packRuleDescriptions()

    Returns a variant list containing all rule descriptions.

    [static] QVariantList JsonTypes::packRuleDescriptions(const QList<Rule> & rules)

    Returns a variant list of the given rules.

    [static] QVariantList JsonTypes::packRules(const QList<Rule> rules)

    Returns a variant map of the given rules.

    [static] QVariantMap JsonTypes::packServerConfiguration(const ServerConfiguration & config)

    [static] QVariantMap JsonTypes::packState(const State & state)

    Returns a variant map of the given state.

    [static] QVariantMap JsonTypes::packStateDescriptor(const StateDescriptor & stateDescriptor)

    Returns a variant map of the given stateDescriptor.

    [static] QVariantMap JsonTypes::packStateEvaluator(const StateEvaluator & stateEvaluator)

    Returns a variant map of the given stateEvaluator.

    [static] QVariantMap JsonTypes::packStateType(const StateType & stateType)

    Returns a variant map of the given stateType.

    [static] QVariantList JsonTypes::packStateTypes(const DeviceClass & deviceClass)

    Returns a variant list of state types for the given deviceClass.

    [static] QVariantList JsonTypes::packSupportedDevices(const VendorId & vendorId)

    Returns a variant list of the supported devices with the given vendorId.

    [static] QVariantList JsonTypes::packSupportedVendors()

    Returns a variant list of the supported vendors.

    [static] QVariantMap JsonTypes::packTag(const Tag & tag)

    Returns a variant map of the given tag.

    [static] QVariantMap JsonTypes::packTimeDescriptor(const TimeDescriptor & timeDescriptor)

    Returns a variant map of the given timeDescriptor.

    [static] QVariantMap JsonTypes::packTimeEventItem(const TimeEventItem & timeEventItem)

    Returns a variant map of the given timeEventItem.

    [static] QVariantMap JsonTypes::packTokenInfo(const TokenInfo & tokenInfo)

    [static] QVariantMap JsonTypes::packVendor(const Vendor & vendor)

    Returns a variant map of the given vendor.

    [static] QVariantMap JsonTypes::packWebServerConfiguration(const WebServerConfiguration & config)

    [static] QVariantMap JsonTypes::packWiredNetworkDevice(WiredNetworkDevice * networkDevice)

    Returns a variant map of the given networkDevice.

    [static] QVariantMap JsonTypes::packWirelessAccessPoint(WirelessAccessPoint * wirelessAccessPoint)

    Returns a variant map of the given wirelessAccessPoint.

    [static] QVariantMap JsonTypes::packWirelessNetworkDevice(WirelessNetworkDevice * networkDevice)

    Returns a variant map of the given networkDevice.

    [static] CalendarItem JsonTypes::unpackCalendarItem(const QVariantMap & calendarItemMap)

    Returns a CalendarItem created from the given calendarItemMap.

    [static] EventDescriptor JsonTypes::unpackEventDescriptor(const QVariantMap & eventDescriptorMap)

    Returns a EventDescriptor created from the given eventDescriptorMap.

    [static] LogFilter JsonTypes::unpackLogFilter(const QVariantMap & logFilterMap)

    Returns a LogFilter created from the given logFilterMap.

    [static] Param JsonTypes::unpackParam(const QVariantMap & paramMap)

    Returns a Param created from the given paramMap.

    [static] ParamDescriptor JsonTypes::unpackParamDescriptor(const QVariantMap & paramMap)

    Returns a ParamDescriptor created from the given paramMap.

    [static] QList<ParamDescriptor> JsonTypes::unpackParamDescriptors(const QVariantList & paramList)

    Returns a list of ParamDescriptor created from the given paramList.

    [static] ParamList JsonTypes::unpackParams(const QVariantList & paramList)

    Returns a ParamList created from the given paramList.

    [static] RepeatingOption JsonTypes::unpackRepeatingOption(const QVariantMap & repeatingOptionMap)

    Returns a RepeatingOption created from the given repeatingOptionMap.

    [static] Rule JsonTypes::unpackRule(const QVariantMap & ruleMap)

    Returns a Rule created from the given ruleMap.

    [static] RuleAction JsonTypes::unpackRuleAction(const QVariantMap & ruleActionMap)

    Returns a RuleAction created from the given ruleActionMap.

    [static] RuleActionParam JsonTypes::unpackRuleActionParam(const QVariantMap & ruleActionParamMap)

    Returns a RuleActionParam created from the given ruleActionParamMap.

    [static] RuleActionParamList JsonTypes::unpackRuleActionParams(const QVariantList & ruleActionParamList)

    Returns a RuleActionParamList created from the given ruleActionParamList.

    [static] ServerConfiguration JsonTypes::unpackServerConfiguration(const QVariantMap & serverConfigurationMap)

    [static] StateDescriptor JsonTypes::unpackStateDescriptor(const QVariantMap & stateDescriptorMap)

    Returns a StateDescriptor created from the given stateDescriptorMap.

    [static] StateEvaluator JsonTypes::unpackStateEvaluator(const QVariantMap & stateEvaluatorMap)

    Returns a StateEvaluator created from the given stateEvaluatorMap.

    [static] Tag JsonTypes::unpackTag(const QVariantMap & tagMap)

    Returns a Tag created from the given tagMap.

    [static] TimeDescriptor JsonTypes::unpackTimeDescriptor(const QVariantMap & timeDescriptorMap)

    Returns a TimeDescriptor created from the given timeDescriptorMap.

    [static] TimeEventItem JsonTypes::unpackTimeEventItem(const QVariantMap & timeEventItemMap)

    Returns a TimeEventItem created from the given timeEventItemMap.

    [static] WebServerConfiguration JsonTypes::unpackWebServerConfiguration(const QVariantMap & webServerConfigurationMap)

    [static] QPair<bool, QString> JsonTypes::validateBasicType(const QVariant & variant)

    Verify the given variant with the possible BasicType. Returns the error string and false if the params are not valid.

    [static] QPair<bool, QString> JsonTypes::validateEnum(const QVariantList & enumDescription, const QVariant & value)

    Compairs the given value with the given enumDescription. Returns the error string and false if the enum does not contain the given value.

    [static] QPair<bool, QString> JsonTypes::validateList(const QVariantList & templateList, const QVariantList & list)

    Compairs the given list with the given templateList. Returns the error string and false if the params are not valid.

    [static] QPair<bool, QString> JsonTypes::validateMap(const QVariantMap & templateMap, const QVariantMap & map)

    Compairs the given map with the given templateMap. Returns the error string and false if the params are not valid.

    [static] QPair<bool, QString> JsonTypes::validateProperty(const QVariant & templateValue, const QVariant & value)

    Compairs the given value with the given templateValue. Returns the error string and false if the params are not valid.

    [static] QPair<bool, QString> JsonTypes::validateVariant(const QVariant & templateVariant, const QVariant & variant)

    Compairs the given variant with the given templateVariant. Returns the error string and false if the params are not valid.