API Documentation
Documentation for developing SailfishOS applicationsSimMobileDataFilter Class
(Sailfish::Mdm::SimMobileDataFilter)The SimMobileDataFilter class controls filter rules for mobile data. More...
Header: | #include <mdm-simmobiledatafilter.h> |
Properties
- defaultAction : SimFilter::Action
- ready : const bool
- rules : SimFilter::RuleList
Public Functions
SimMobileDataFilter(QObject *parent = 0) | |
~SimMobileDataFilter() | |
bool | clearRules() |
SimFilter::Action | defaultAction() const |
bool | hasRuleForImsi(const QString &imsi) const |
bool | ready() const |
bool | removeRule(const QString &imsi) |
SimFilter::RuleList | rules() const |
bool | setDefaultAction(SimFilter::Action action) |
bool | setRule(const SimFilter::Rule &rule) |
bool | setRules(const SimFilter::RuleList &rules) |
Signals
void | defaultActionChanged() |
void | readyChanged() |
void | ruleAdded(const Sailfish::Mdm::SimFilter::Rule &rule) |
void | ruleRemoved(const QString &imsi) |
void | rulesChanged(const Sailfish::Mdm::SimFilter::RuleList &oldRules, const Sailfish::Mdm::SimFilter::RuleList &newRules) |
Detailed Description
The SimMobileDataFilter class controls filter rules for mobile data.
To use this class, clients must add the following to their qmake project:
CONFIG += link_pkgconfig PKGCONFIG += sailfishmdm
and then #include <mdm-simmobiledatafilter.h>
.
Example of usage:
#include <mdm-simmobiledatafilter.h> int main(int argc, char **argv) { QCoreApplication app(arg, argv); SimMobileDataFilter *mobileDataFilter = new SimMobileDataFilter; QObject::connect(mobileDataFilter, &SimMobileDataFilter::readyChanged, [mobileDataFilter] { qInfo() << mobileDataFilter->rules().count() << "rules are currently set"; SimFilter::Rule rule("123456789", SimFilter::Block); mobileDataFilter->addRule(rule); QObject::connect(mobileDataFilter, &SimMobileDataFilter::ruleAdded, [rule] { qInfo() << "Rule added for IMSI" << rule.imsi; app.quit(); }); }); return app.exec(); }
Property Documentation
defaultAction : SimFilter::Action
The default action for mobile data.
Access functions:
SimFilter::Action | defaultAction() const |
bool | setDefaultAction(SimFilter::Action action) |
Notifier signal:
void | defaultActionChanged() |
ready : const bool
True when the mobile data filter is ready to be used and the property values are valid.
Access functions:
bool | ready() const |
Notifier signal:
void | readyChanged() |
rules : SimFilter::RuleList
The filter rules for mobile data.
Access functions:
SimFilter::RuleList | rules() const |
bool | setRules(const SimFilter::RuleList &rules) |
Notifier signal:
void | rulesChanged(const Sailfish::Mdm::SimFilter::RuleList &oldRules, const Sailfish::Mdm::SimFilter::RuleList &newRules) |
Member Function Documentation
SimMobileDataFilter::SimMobileDataFilter(QObject *parent = 0)
Default constructs an instance of SimMobileDataFilter.
SimMobileDataFilter::~SimMobileDataFilter()
Destroys the instance of SimMobileDataFilter.
bool SimMobileDataFilter::clearRules()
Clears the list of rules.
This is an asynchronous call. When the call completes, rulesChanged() is emitted.
Returns true if the asynchronous call was sent. Returns false and does nothing if there are no existing rules.
bool SimMobileDataFilter::hasRuleForImsi(const QString &imsi) const
Returns whether there is an existing mobile data rule for the specified imsi.
bool SimMobileDataFilter::removeRule(const QString &imsi)
Removes the rule with the specified imsi from the list of mobile data rules.
This is an asynchronous call. When the call completes, rulesChanged() and ruleRemoved() are emitted.
Returns true if the asynchronous call was sent. Returns false and does nothing if the IMSI is invalid, or if there is no existing rule for this IMSI.
[signal]
void SimMobileDataFilter::ruleAdded(const Sailfish::Mdm::SimFilter::Rule &rule)
This signal is emitted when a new mobile data rule is added.
[signal]
void SimMobileDataFilter::ruleRemoved(const QString &imsi)
This signal is emitted when a mobile data rule with the specified imsi is removed.
[signal]
void SimMobileDataFilter::rulesChanged(const Sailfish::Mdm::SimFilter::RuleList &oldRules, const Sailfish::Mdm::SimFilter::RuleList &newRules)
This signal is emitted when the list of mobile data rules from oldRules to newRules, due to modifications of the entire list, or individual rules within the list.
Note: Notifier signal for property rules.
bool SimMobileDataFilter::setRule(const SimFilter::Rule &rule)
Adds or modifies rule in the list of mobile data rules.
This is an asynchronous call. When the call completes, rulesChanged() is emitted. If this is a new rule, ruleAdded() is also emitted.
Returns true if the asynchronous call was sent. Returns false and does nothing if the IMSI is invalid, or if there is an existing rule with the same IMSI and action.
bool SimMobileDataFilter::setRules(const SimFilter::RuleList &rules)
Sets the list of rules to rules.
This is an asynchronous call. When the call completes, rulesChanged() is emitted.
Returns true if the asynchronous call was sent. Returns false and does nothing if any IMSI is invalid, or if the given rules match the existing rules.
Note: Setter function for property rules.
See also rules().