Userspace Resource Manager
Loading...
Searching...
No Matches
SignalAPIsExamples.cpp
1
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2
// SPDX-License-Identifier: BSD-3-Clause
3
13
14
#include <iostream>
15
16
#include <Urm/UrmAPIs.h>
17
18
/*
19
Signal:
20
- SigId: "0x0003"
21
Category: "0x0d"
22
Name: "SMOOTH_SCROLL"
23
Enable: false
24
TargetsEnabled: ["sun"]
25
Permissions: ["third_party"]
26
Derivatives: ["solar"]
27
Timeout: 4000
28
Resources:
29
- {ResCode: "0x00000008", ResInfo: "0x00000000", Values: [300, 400]}
30
- {ResCode: "0x000000f1", ResInfo: "0x00000400", Values: [12, 45, 67]}
31
- {ResCode: "0x0000abcd", ResInfo: "0x00000020", Values: [5]}
32
- {ResCode: "0x0000ea0d", ResInfo: "0x00000200", Values: [87]}
33
*/
34
void
func1() {
35
// Use the tuneSignal to provision or acquire a signal
36
// Signature:
37
/*
38
int64_t tuneSignal(uint32_t signalCode,
39
int64_t duration,
40
int32_t properties,
41
const char* appName,
42
const char* scenario,
43
int32_t numArgs,
44
uint32_t* list);
45
*/
46
47
// First generate the Signal Code (unsigned 32-bit identifier)
48
49
// Here the SigID "0x0003"
50
// and the Category of Signal is "0x0d"
51
// The SigCode is a combination of the above fields
52
// Let's say this is a custom signal (i.e. one defined by the user)
53
// then the SigCode will be as follows:
54
// 0x 80 [MSB value of 1 indicates custom Signal] 0d [Category] 0003 [SigID]
55
uint32_t sigCode = 0x8000030d;
56
57
/*
58
* Alternative Approach to construct opcode
59
* sigCode = CUSTOM(CONSTRUCT_SIG_CODE(0x0d, 0x0003))
60
*/
61
62
// Duration to tune the signal for
63
int64_t duration = 20000;
// 20 seconds
64
65
int32_t properties = 0;
66
// The properties field signifies the Request Priority and the Background Processing status
67
// A value of 0 corresponds to: Priority: HIGH, Enabled for Background Processing: False
68
69
// appName and scenario fields are specific to the user-case
70
71
// Finally we have no additional arguments hence, the list argument can be kept as nullptr.
72
73
int64_t handle =
tuneSignal
(sigCode, duration, properties,
""
,
""
, 0,
nullptr
);
74
}
tuneSignal
int64_t tuneSignal(uint32_t sigId, uint32_t sigType, int64_t duration, int32_t properties, const char *appName, const char *scenario, int32_t numArgs, uint32_t *list)
Tune the signal with the given ID.
docs
Examples
SignalAPIsExamples.cpp
Generated on
for Userspace Resource Manager by
1.15.0