mirror of
https://gitee.com/openharmony/sensors_sensor
synced 2025-01-19 12:46:27 +00:00
Fix typo in sensor repo
Signed-off-by: Chao Liu <liuchao741@huawei.com>
This commit is contained in:
parent
ddb2661143
commit
bc82e9e4ac
@ -145,7 +145,7 @@ The sensor JS APIs listen for sensor data changes. If an API is called multiple
|
||||
1. Import the sensor package.
|
||||
2. Subscribe to and listen for data changes of an acceleration sensor.
|
||||
3. Unsubscribe from data changes of the acceleration sensor.
|
||||
4. Subscribe to and listen for a data change of a acceleration sensor.
|
||||
4. Subscribe to and listen for a data change of an acceleration sensor.
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -209,7 +209,7 @@ void SensorServiceClient::ProcessDeathObserver(const wptr<IRemoteObject> &object
|
||||
CALL_LOG_ENTER;
|
||||
(void)object;
|
||||
CHKPV(dataChannel_);
|
||||
// STEP1 : Destroy revious data channel
|
||||
// STEP1 : Destroy previous data channel
|
||||
dataChannel_->DestroySensorDataChannel();
|
||||
// STEP2 : Restore data channel
|
||||
dataChannel_->RestoreSensorDataChannel();
|
||||
|
@ -65,7 +65,7 @@ ErrCode SensorServiceProxy::EnableSensor(uint32_t sensorId, int64_t samplingPeri
|
||||
int32_t ret = remote->SendRequest(ISensorService::ENABLE_SENSOR, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
HiSysEvent::Write(HiSysEvent::Domain::SENSOR, "SENSOR_SERVICE_IPC_EXCEPTION",
|
||||
HiSysEvent::EventType::FAULT, "PKG_NAME", "EnaleSensor", "ERROR_CODE", ret);
|
||||
HiSysEvent::EventType::FAULT, "PKG_NAME", "EnableSensor", "ERROR_CODE", ret);
|
||||
SEN_HILOGE("failed, ret:%{public}d", ret);
|
||||
}
|
||||
return static_cast<ErrCode>(ret);
|
||||
|
@ -112,7 +112,7 @@ typedef struct SensorInfo {
|
||||
float precision; /**< Sensor accuracy */
|
||||
float power; /**< Sensor power */
|
||||
int64_t minSamplePeriod; /**< Minimum sample period allowed, in ns */
|
||||
int64_t maxSamplePeriod; /**< Maxmum sample period allowed, in ns */
|
||||
int64_t maxSamplePeriod; /**< Maximum sample period allowed, in ns */
|
||||
} SensorInfo;
|
||||
|
||||
/**
|
||||
|
@ -326,7 +326,7 @@ HWTEST_F(SensorAgentTest, SetModeTest_003, TestSize.Level1)
|
||||
* Function: SubscribeSensor
|
||||
* FunctionPoints: Check the interface function
|
||||
* EnvConditions: mobile that can run ohos test framework
|
||||
* CaseDescription: Verify the senser service framework process.
|
||||
* CaseDescription: Verify the sensor service framework process.
|
||||
*/
|
||||
HWTEST_F(SensorAgentTest, SensorNativeApiTest_001, TestSize.Level1)
|
||||
{
|
||||
@ -361,7 +361,7 @@ HWTEST_F(SensorAgentTest, GetProcCpuUsageTest_001, TestSize.Level1)
|
||||
const std::string process_name = "sensors";
|
||||
auto usage = cpuInfo.GetProcCpuUsage(process_name);
|
||||
SEN_HILOGD("The CPU usage of the %{public}s process is %{public}.2f", process_name.c_str(), usage);
|
||||
ASSERT_TRUE(usage < SYSTEM_INFO::CPU_USAGE_LOAD && usage != SYSTEM_INFO::CPU_USAGE_UNKONW);
|
||||
ASSERT_TRUE(usage < SYSTEM_INFO::CPU_USAGE_LOAD && usage != SYSTEM_INFO::CPU_USAGE_UNKNOWN);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -369,7 +369,7 @@ HWTEST_F(SensorAgentTest, GetProcCpuUsageTest_001, TestSize.Level1)
|
||||
* Function: GetAllSensors
|
||||
* FunctionPoints: Check the interface function
|
||||
* EnvConditions: mobile that can run ohos test framework
|
||||
* CaseDescription: Verify the senser service framework process.
|
||||
* CaseDescription: Verify the sensor service framework process.
|
||||
*/
|
||||
HWTEST_F(SensorAgentTest, SensorListTest_001, TestSize.Level1)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ constexpr int32_t INVALID_SENSOR_ID = -1;
|
||||
constexpr int32_t SENSOR_SUBSCRIBE_FAILURE = 1001;
|
||||
constexpr int32_t INPUT_ERROR = 202;
|
||||
constexpr float BODY_STATE_EXCEPT = 1.0f;
|
||||
constexpr float THREESHOLD = 0.000001f;
|
||||
constexpr float THRESHOLD = 0.000001f;
|
||||
}
|
||||
static std::map<std::string, int64_t> g_samplingPeriod = {
|
||||
{"normal", 200000000},
|
||||
@ -77,7 +77,7 @@ static bool copySensorData(sptr<AsyncCallbackInfo> callbackInfo, SensorEvent *ev
|
||||
std::lock_guard<std::mutex> onBodyLock(bodyMutex_);
|
||||
g_bodyState = *data;
|
||||
callbackInfo->data.sensorData.data[0] =
|
||||
(fabs(g_bodyState - BODY_STATE_EXCEPT) < THREESHOLD) ? true : false;
|
||||
(fabs(g_bodyState - BODY_STATE_EXCEPT) < THRESHOLD) ? true : false;
|
||||
return true;
|
||||
}
|
||||
if (memcpy_s(callbackInfo->data.sensorData.data, event->dataLen, data, event->dataLen) != EOK) {
|
||||
@ -1212,7 +1212,7 @@ napi_value GetBodyState(napi_env env, napi_callback_info info)
|
||||
"register success callback fail");
|
||||
std::lock_guard<std::mutex> onBodyLock(bodyMutex_);
|
||||
asyncCallbackInfo->data.sensorData.data[0] =
|
||||
(fabs(g_bodyState - BODY_STATE_EXCEPT) < THREESHOLD) ? true : false;
|
||||
(fabs(g_bodyState - BODY_STATE_EXCEPT) < THRESHOLD) ? true : false;
|
||||
EmitUvEventLoop(asyncCallbackInfo);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -318,8 +318,8 @@ bool ConvertToSensorData(const napi_env &env, sptr<AsyncCallbackInfo> asyncCallb
|
||||
return ConvertToBodyData(env, asyncCallbackInfo, result);
|
||||
}
|
||||
size_t size = g_sensorAttributeList[sensorTypeId].size();
|
||||
uint32_t dataLenth = asyncCallbackInfo->data.sensorData.dataLength / sizeof(float);
|
||||
CHKNCF(env, (size <= dataLenth), "Data length mismatch");
|
||||
uint32_t dataLength = asyncCallbackInfo->data.sensorData.dataLength / sizeof(float);
|
||||
CHKNCF(env, (size <= dataLength), "Data length mismatch");
|
||||
|
||||
CHKNRF(env, napi_create_object(env, &result[1]), "napi_create_object");
|
||||
napi_value message = nullptr;
|
||||
@ -434,7 +434,7 @@ void EmitAsyncCallbackWork(sptr<AsyncCallbackInfo> asyncCallbackInfo)
|
||||
sptr<AsyncCallbackInfo> asyncCallbackInfo(static_cast<AsyncCallbackInfo *>(data));
|
||||
/**
|
||||
* After the asynchronous task is created, the asyncCallbackInfo reference count is reduced
|
||||
* to 0 destructions, so you need to add 1 to the asyncCallbackInfo reference count when the
|
||||
* to 0 destruction, so you need to add 1 to the asyncCallbackInfo reference count when the
|
||||
* asynchronous task is created, and subtract 1 from the reference count after the naked
|
||||
* pointer is converted to a pointer when the asynchronous task is executed, the reference
|
||||
* count of the smart pointer is guaranteed to be 1.
|
||||
@ -494,7 +494,7 @@ void EmitUvEventLoop(sptr<AsyncCallbackInfo> asyncCallbackInfo)
|
||||
DeleteWork(work);
|
||||
/**
|
||||
* After the asynchronous task is created, the asyncCallbackInfo reference count is reduced
|
||||
* to 0 destructions, so you need to add 1 to the asyncCallbackInfo reference count when the
|
||||
* to 0 destruction, so you need to add 1 to the asyncCallbackInfo reference count when the
|
||||
* asynchronous task is created, and subtract 1 from the reference count after the naked
|
||||
* pointer is converted to a pointer when the asynchronous task is executed, the reference
|
||||
* count of the smart pointer is guaranteed to be 1.
|
||||
@ -554,7 +554,7 @@ void EmitPromiseWork(sptr<AsyncCallbackInfo> asyncCallbackInfo)
|
||||
sptr<AsyncCallbackInfo> asyncCallbackInfo(static_cast<AsyncCallbackInfo *>(data));
|
||||
/**
|
||||
* After the asynchronous task is created, the asyncCallbackInfo reference count is reduced
|
||||
* to 0 destructions, so you need to add 1 to the asyncCallbackInfo reference count when the
|
||||
* to 0 destruction, so you need to add 1 to the asyncCallbackInfo reference count when the
|
||||
* asynchronous task is created, and subtract 1 from the reference count after the naked
|
||||
* pointer is converted to a pointer when the asynchronous task is executed, the reference
|
||||
* count of the smart pointer is guaranteed to be 1.
|
||||
|
@ -2052,7 +2052,7 @@ describe("SensorJsTest", function () {
|
||||
]
|
||||
/*
|
||||
* @tc.name: Sensor_CreateRotationMatrix_012
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -2076,7 +2076,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* tc.name: Sensor_CreateRotationMatrix_013
|
||||
* tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* tc.require: SR000GH2A2
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -2098,7 +2098,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* tc.name: Sensor_CreateRotationMatrix_014
|
||||
* tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -2758,17 +2758,17 @@ describe("SensorJsTest", function () {
|
||||
]
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_CreateQuaterniont_001
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.name: Sensor_CreateQuaternion_001
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2RP
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_001', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaterniont_001 start')
|
||||
it('Sensor_CreateQuaternion_001', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaternion_001 start')
|
||||
sensor.getQuaternion([0.52, -0.336, -0.251], (error, data) =>{
|
||||
console.info('Sensor_CreateQuaterniont_001' + 'lengh:' + data.length);
|
||||
console.info('Sensor_CreateQuaternion_001' + 'length:' + data.length);
|
||||
if (error) {
|
||||
console.info('Sensor_CreateQuaterniont_001 failed');
|
||||
console.info('Sensor_CreateQuaternion_001 failed');
|
||||
expect(false).assertTrue();
|
||||
} else {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
@ -2781,16 +2781,16 @@ describe("SensorJsTest", function () {
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_CreateQuaterniont_002
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.name: Sensor_CreateQuaternion_002
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2RP
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_002', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaterniont_002 start')
|
||||
it('Sensor_CreateQuaternion_002', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaternion_002 start')
|
||||
sensor.getQuaternion([3.40282e+38, 3.40282e+38, 3.40282e+38], (error, data) =>{
|
||||
if (error) {
|
||||
console.info('Sensor_CreateQuaterniont_002 failed');
|
||||
console.info('Sensor_CreateQuaternion_002 failed');
|
||||
expect(false).assertTrue();
|
||||
} else {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
@ -2803,16 +2803,16 @@ describe("SensorJsTest", function () {
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_CreateQuaterniont_003
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.name: Sensor_CreateQuaternion_003
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2RP
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_003', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaterniont_003 start')
|
||||
it('Sensor_CreateQuaternion_003', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaternion_003 start')
|
||||
sensor.getQuaternion([0, 0, 0], (error, data) =>{
|
||||
if (error) {
|
||||
console.info('Sensor_CreateQuaterniont_003 failed');
|
||||
console.info('Sensor_CreateQuaternion_003 failed');
|
||||
expect(false).assertTrue();
|
||||
} else {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
@ -2822,20 +2822,20 @@ describe("SensorJsTest", function () {
|
||||
}
|
||||
done()
|
||||
})
|
||||
console.info("Sensor_CreateQuaterniont_003 end")
|
||||
console.info("Sensor_CreateQuaternion_003 end")
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_CreateQuaterniont_004
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.name: Sensor_CreateQuaternion_004
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2RP
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_004', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaterniont_004 start')
|
||||
it('Sensor_CreateQuaternion_004', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaternion_004 start')
|
||||
sensor.getQuaternion([-0.325, -0.562, -0.25], (error, data) =>{
|
||||
if (error) {
|
||||
console.info('Sensor_CreateQuaterniont_004 failed');
|
||||
console.info('Sensor_CreateQuaternion_004 failed');
|
||||
expect(false).assertTrue();
|
||||
} else {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
@ -2845,17 +2845,17 @@ describe("SensorJsTest", function () {
|
||||
}
|
||||
done()
|
||||
})
|
||||
console.info("Sensor_CreateQuaterniont_004 end")
|
||||
console.info("Sensor_CreateQuaternion_004 end")
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_CreateQuaterniont_005
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.name: Sensor_CreateQuaternion_005
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2RP
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_005', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaterniont_005 start')
|
||||
it('Sensor_CreateQuaternion_005', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaternion_005 start')
|
||||
try {
|
||||
sensor.getQuaternion([0.25, 0.14], (error, data) =>{
|
||||
if (error) {
|
||||
@ -2870,19 +2870,19 @@ describe("SensorJsTest", function () {
|
||||
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
|
||||
done()
|
||||
}
|
||||
console.info("Sensor_CreateQuaterniont_005 end")
|
||||
console.info("Sensor_CreateQuaternion_005 end")
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_CreateQuaterniont_006
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.name: Sensor_CreateQuaternion_006
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2RP
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_006', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaterniont_006 start')
|
||||
it('Sensor_CreateQuaternion_006', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaternion_006 start')
|
||||
sensor.getQuaternion([0.52, -0.336, -0.251]).then((data) => {
|
||||
console.info('Sensor_CreateQuaterniont_006');
|
||||
console.info('Sensor_CreateQuaternion_006');
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
console.info("data[" + i + "]: " + data[i]);
|
||||
expect(data[i]).assertEqual(result[0][i])
|
||||
@ -2893,20 +2893,20 @@ describe("SensorJsTest", function () {
|
||||
console.info('promise failed')
|
||||
done()
|
||||
})
|
||||
console.info("Sensor_CreateQuaterniont_006 end")
|
||||
console.info("Sensor_CreateQuaternion_006 end")
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_CreateQuaterniont_007
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.name: Sensor_CreateQuaternion_007
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2RP
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_007', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaterniont_007 start')
|
||||
it('Sensor_CreateQuaternion_007', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaternion_007 start')
|
||||
try {
|
||||
sensor.getQuaternion([0, 0]).then((data) => {
|
||||
console.info('Sensor_CreateQuaterniont_007');
|
||||
console.info('Sensor_CreateQuaternion_007');
|
||||
expect(false).assertTrue();
|
||||
done()
|
||||
}, (error) => {
|
||||
@ -2919,19 +2919,19 @@ describe("SensorJsTest", function () {
|
||||
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
|
||||
done()
|
||||
}
|
||||
console.info("Sensor_CreateQuaterniont_007 end")
|
||||
console.info("Sensor_CreateQuaternion_007 end")
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_CreateQuaterniont_008
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.name: Sensor_CreateQuaternion_008
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2RP
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_008', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaterniont_008 start')
|
||||
it('Sensor_CreateQuaternion_008', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaternion_008 start')
|
||||
sensor.getQuaternion([0, 0, 0]).then((data) => {
|
||||
console.info('Sensor_CreateQuaterniont_008');
|
||||
console.info('Sensor_CreateQuaternion_008');
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
console.info("data[" + i + "]: " + data[i]);
|
||||
expect(data[i]).assertEqual(result[2][i])
|
||||
@ -2942,19 +2942,19 @@ describe("SensorJsTest", function () {
|
||||
console.info('promise failed')
|
||||
done()
|
||||
})
|
||||
console.info("Sensor_CreateQuaterniont_008 end")
|
||||
console.info("Sensor_CreateQuaternion_008 end")
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_CreateQuaterniont_009
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.name: Sensor_CreateQuaternion_009
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2RP
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_009', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaterniont_009 start')
|
||||
it('Sensor_CreateQuaternion_009', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaternion_009 start')
|
||||
sensor.getQuaternion([-0.325, -0.562, -0.25]).then((data) => {
|
||||
console.info('Sensor_CreateQuaterniont_009');
|
||||
console.info('Sensor_CreateQuaternion_009');
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
console.info("data[" + i + "]: " + data[i]);
|
||||
expect(data[i]).assertEqual(result[3][i])
|
||||
@ -2968,16 +2968,16 @@ describe("SensorJsTest", function () {
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_CreateQuaterniont_010
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.name: Sensor_CreateQuaternion_010
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2RP
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_010', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaterniont_010 start')
|
||||
it('Sensor_CreateQuaternion_010', 0,async function (done) {
|
||||
console.info('Sensor_CreateQuaternion_010 start')
|
||||
try {
|
||||
sensor.getQuaternion([0.25, 0.14]).then((data) => {
|
||||
console.info('Sensor_CreateQuaterniont_010');
|
||||
console.info('Sensor_CreateQuaternion_010');
|
||||
expect(false).assertTrue();
|
||||
done()
|
||||
},(error) => {
|
||||
@ -2995,12 +2995,12 @@ describe("SensorJsTest", function () {
|
||||
/*
|
||||
* test
|
||||
*
|
||||
* @tc.name: Sensor_CreateQuaterniont_011
|
||||
* @tc.name: Sensor_CreateQuaternion_011
|
||||
* @tc.desc: Verification results of the incorrect parameters of the test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_011', 0, async function (done) {
|
||||
it('Sensor_CreateQuaternion_011', 0, async function (done) {
|
||||
try {
|
||||
sensor.createQuaternion()
|
||||
} catch (err) {
|
||||
@ -3013,12 +3013,12 @@ describe("SensorJsTest", function () {
|
||||
/*
|
||||
* test
|
||||
*
|
||||
* @tc.name: Sensor_CreateQuaterniont_012
|
||||
* @tc.name: Sensor_CreateQuaternion_012
|
||||
* @tc.desc: Verification results of the incorrect parameters of the test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_012', 0, async function (done) {
|
||||
it('Sensor_CreateQuaternion_012', 0, async function (done) {
|
||||
try {
|
||||
sensor.createQuaternion(-1)
|
||||
} catch (err) {
|
||||
@ -3031,12 +3031,12 @@ describe("SensorJsTest", function () {
|
||||
/*
|
||||
* test
|
||||
*
|
||||
* @tc.name: Sensor_CreateQuaterniont_013
|
||||
* @tc.name: Sensor_CreateQuaternion_013
|
||||
* @tc.desc: Verification results of the incorrect parameters of the test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_013', 0, async function (done) {
|
||||
it('Sensor_CreateQuaternion_013', 0, async function (done) {
|
||||
try {
|
||||
sensor.createQuaternion([0.52, -0.336, -0.251], -1)
|
||||
} catch (err) {
|
||||
@ -3049,12 +3049,12 @@ describe("SensorJsTest", function () {
|
||||
/*
|
||||
* test
|
||||
*
|
||||
* @tc.name: Sensor_CreateQuaterniont_014
|
||||
* @tc.name: Sensor_CreateQuaternion_014
|
||||
* @tc.desc: Verification results of the incorrect parameters of the test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_014', 0, async function (done) {
|
||||
it('Sensor_CreateQuaternion_014', 0, async function (done) {
|
||||
try {
|
||||
sensor.createQuaternion().then((data) => {
|
||||
expect(true).assertfalse()
|
||||
@ -3073,12 +3073,12 @@ describe("SensorJsTest", function () {
|
||||
/*
|
||||
* test
|
||||
*
|
||||
* @tc.name: Sensor_CreateQuaterniont_015
|
||||
* @tc.name: Sensor_CreateQuaternion_015
|
||||
* @tc.desc: Verification results of the incorrect parameters of the test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_015', 0, async function (done) {
|
||||
it('Sensor_CreateQuaternion_015', 0, async function (done) {
|
||||
try {
|
||||
sensor.createQuaternion(-1).then((data) => {
|
||||
expect(true).assertfalse()
|
||||
@ -3097,12 +3097,12 @@ describe("SensorJsTest", function () {
|
||||
/*
|
||||
* test
|
||||
*
|
||||
* @tc.name: Sensor_CreateQuaterniont_016
|
||||
* @tc.name: Sensor_CreateQuaternion_016
|
||||
* @tc.desc: Verification results of the incorrect parameters of the test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
it('Sensor_CreateQuaterniont_016', 0, async function (done) {
|
||||
it('Sensor_CreateQuaternion_016', 0, async function (done) {
|
||||
try {
|
||||
sensor.createQuaternion([0.52, -0.336, -0.251], -1).then((data) => {
|
||||
expect(true).assertfalse()
|
||||
@ -3122,7 +3122,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetGeomagneticDip_001
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2OG
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3137,14 +3137,14 @@ describe("SensorJsTest", function () {
|
||||
expect(data).assertEqual(getGeomagneticDipResult[0])
|
||||
}
|
||||
done()
|
||||
console.info('Sensor_GetGeomagneticDip_001' + 'lengh:' + data.length);
|
||||
console.info('Sensor_GetGeomagneticDip_001' + 'length:' + data.length);
|
||||
})
|
||||
console.info("Sensor_GetGeomagneticDip_001 end")
|
||||
})
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetGeomagneticDip_002
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2OG
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3169,7 +3169,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetGeomagneticDip_003
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3188,7 +3188,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetGeomagneticDip_004
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3204,7 +3204,7 @@ describe("SensorJsTest", function () {
|
||||
expect(data).assertEqual(getGeomagneticDipResult[0])
|
||||
}
|
||||
done()
|
||||
console.info('Sensor_GetGeomagneticDip_004' + 'lengh:' + data.length);
|
||||
console.info('Sensor_GetGeomagneticDip_004' + 'length:' + data.length);
|
||||
})
|
||||
} catch(error) {
|
||||
console.info(error);
|
||||
@ -3217,7 +3217,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetGeomagneticDip_005
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3243,7 +3243,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetGeomagneticDip_006
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3269,7 +3269,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetAltitude_001
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2OG
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3290,7 +3290,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetAltitude_002
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2OG
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3311,7 +3311,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetAltitude_003
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2OG
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3329,7 +3329,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetAltitude_004
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2OG
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3347,7 +3347,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetAltitude_005
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3366,7 +3366,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetAltitude_006
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3382,7 +3382,7 @@ describe("SensorJsTest", function () {
|
||||
expect(data).assertEqual(getGeomagneticDipResult[0])
|
||||
}
|
||||
done()
|
||||
console.info('Sensor_GetAltitude_006' + 'lengh:' + data.length);
|
||||
console.info('Sensor_GetAltitude_006' + 'length:' + data.length);
|
||||
})
|
||||
} catch(error) {
|
||||
console.info(error);
|
||||
@ -3395,7 +3395,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetAltitude_007
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3421,7 +3421,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetAltitude_008
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3454,7 +3454,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_TransformCoordinateSystem_001
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3474,7 +3474,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_TransformCoordinateSystem_002
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3494,7 +3494,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_TransformCoordinateSystem_003
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3515,7 +3515,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_TransformCoordinateSystem_004
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3536,7 +3536,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_TransformCoordinateSystem_005
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3555,7 +3555,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_TransformCoordinateSystem_006
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3583,7 +3583,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_TransformCoordinateSystem_007
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3609,7 +3609,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_TransformCoordinateSystem_008
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3635,7 +3635,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_TransformCoordinateSystem_009
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3661,7 +3661,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_TransformCoordinateSystem_010
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: I5SWJI
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3689,7 +3689,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetSensorList_001
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3711,7 +3711,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetSensorList_002
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3734,7 +3734,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetSensorList_003
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3752,7 +3752,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetSensorList_004
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3779,7 +3779,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetSingleSensor_001
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3800,7 +3800,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetSingleSensor_002
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3828,7 +3828,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetSingleSensor_003
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
@ -3847,7 +3847,7 @@ describe("SensorJsTest", function () {
|
||||
|
||||
/*
|
||||
* @tc.name: Sensor_GetSingleSensor_004
|
||||
* @tc.desc: Verfication results of the incorrect parameters of test interface.
|
||||
* @tc.desc: Verification results of the incorrect parameters of test interface.
|
||||
* @tc.require: AR000GH2TR
|
||||
* @tc.author:
|
||||
*/
|
||||
|
@ -41,9 +41,9 @@ enum {
|
||||
|
||||
constexpr uint32_t SENSOR_INDEX_SHIFT = 8;
|
||||
constexpr uint32_t SENSOR_TYPE_SHIFT = 16;
|
||||
constexpr uint32_t SENSOR_CATAGORY_SHIFT = 24;
|
||||
constexpr uint32_t SENSOR_CATEGORY_SHIFT = 24;
|
||||
|
||||
constexpr uint32_t FLUSH_COMPLETE_ID = ((uint32_t)OTHER << SENSOR_CATAGORY_SHIFT) |
|
||||
constexpr uint32_t FLUSH_COMPLETE_ID = ((uint32_t)OTHER << SENSOR_CATEGORY_SHIFT) |
|
||||
((uint32_t)SENSOR_TYPE_FLUSH << SENSOR_TYPE_SHIFT) |
|
||||
((uint32_t)FIRST_INDEX << SENSOR_INDEX_SHIFT);
|
||||
} // namespace
|
||||
|
@ -366,8 +366,8 @@ ErrCode SensorService::DestroySensorChannel(sptr<IRemoteObject> sensorClient)
|
||||
return CLIENT_PID_INVALID_ERR;
|
||||
}
|
||||
std::lock_guard<std::mutex> serviceLock(serviceLock_);
|
||||
bool destoryRet = clientInfo_.DestroySensorChannel(clientPid);
|
||||
if (!destoryRet) {
|
||||
bool destroyRet = clientInfo_.DestroySensorChannel(clientPid);
|
||||
if (!destroyRet) {
|
||||
SEN_HILOGE("DestroySensorChannel is failed");
|
||||
return DESTROY_SENSOR_CHANNEL_ERR;
|
||||
}
|
||||
@ -386,12 +386,12 @@ void SensorService::ProcessDeathObserver(const wptr<IRemoteObject> &object)
|
||||
SEN_HILOGE("pid is -1");
|
||||
return;
|
||||
}
|
||||
SEN_HILOGI("pid is %{pubilc}d", pid);
|
||||
SEN_HILOGI("pid is %{public}d", pid);
|
||||
std::vector<uint32_t> activeSensors = clientInfo_.GetSensorIdByPid(pid);
|
||||
for (size_t i = 0; i < activeSensors.size(); ++i) {
|
||||
int32_t ret = DisableSensor(activeSensors[i], pid);
|
||||
if (ret != ERR_OK) {
|
||||
SEN_HILOGE("disablesensor failed, ret:%{pubilc}d", ret);
|
||||
SEN_HILOGE("disablesensor failed, ret:%{public}d", ret);
|
||||
}
|
||||
}
|
||||
clientInfo_.DestroySensorChannel(pid);
|
||||
|
@ -27,10 +27,10 @@ namespace {
|
||||
constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorSuspendPolicy" };
|
||||
constexpr uint32_t INVALID_SENSOR_ID = -1;
|
||||
constexpr int64_t MAX_EVENT_COUNT = 1000;
|
||||
constexpr int64_t DEFAULT_SAMPLEING_RATE = 200000000;
|
||||
constexpr int64_t DEFAULT_SAMPLING_RATE = 200000000;
|
||||
constexpr int64_t DEFAULT_REPORT_DELAY = 0;
|
||||
constexpr uint32_t STEP_COUNTER_ID = 524544;
|
||||
constexpr uint32_t STEP_DETECOTR_ID = 590080;
|
||||
constexpr uint32_t STEP_DETECTOR_ID = 590080;
|
||||
} // namespace
|
||||
|
||||
SensorSuspendPolicy::~SensorSuspendPolicy()
|
||||
@ -38,7 +38,7 @@ SensorSuspendPolicy::~SensorSuspendPolicy()
|
||||
|
||||
bool SensorSuspendPolicy::CheckFreezingSensor(uint32_t sensorId)
|
||||
{
|
||||
return ((sensorId == STEP_COUNTER_ID) || (sensorId == STEP_DETECOTR_ID));
|
||||
return ((sensorId == STEP_COUNTER_ID) || (sensorId == STEP_DETECTOR_ID));
|
||||
}
|
||||
|
||||
ErrCode SensorSuspendPolicy::DisableSensor(uint32_t sensorId, int32_t pid)
|
||||
@ -150,7 +150,7 @@ std::vector<uint32_t> SensorSuspendPolicy::GetSensorIdByPid(int32_t pid)
|
||||
void SensorSuspendPolicy::DoActive(const std::shared_ptr<ResourceSchedule::SuspendAppInfo> &info)
|
||||
{
|
||||
CALL_LOG_ENTER;
|
||||
int64_t samplePeriod = DEFAULT_SAMPLEING_RATE;
|
||||
int64_t samplePeriod = DEFAULT_SAMPLING_RATE;
|
||||
int64_t maxReportDelay = DEFAULT_REPORT_DELAY;
|
||||
std::vector<uint32_t> sensorIdList;
|
||||
std::lock_guard<std::mutex> suspendLock(suspendMutex_);
|
||||
|
@ -21,7 +21,7 @@
|
||||
namespace OHOS {
|
||||
namespace Sensors {
|
||||
namespace SYSTEM_INFO {
|
||||
static constexpr double CPU_USAGE_UNKONW = -1.0;
|
||||
static constexpr double CPU_USAGE_UNKNOWN = -1.0;
|
||||
static constexpr double CPU_USAGE_LOAD = 20.0;
|
||||
static constexpr double CPU_USAGE_MAX = 100.0;
|
||||
class SystemInfo {
|
||||
|
@ -195,14 +195,14 @@ double CpuInfo::GetSystemCpuUsage()
|
||||
int32_t ret = GetSystemCpuStatInfo(first);
|
||||
if (ret != OHOS::Sensors::SUCCESS) {
|
||||
SEN_HILOGE("Failed to obtain CPU information, errcode:%{public}d", ret);
|
||||
return CPU_USAGE_UNKONW;
|
||||
return CPU_USAGE_UNKNOWN;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP));
|
||||
Total_Cpu_Occupy second {};
|
||||
ret = GetSystemCpuStatInfo(second);
|
||||
if (ret != OHOS::Sensors::SUCCESS) {
|
||||
SEN_HILOGE("Failed to obtain CPU information, errcode:%{public}d", ret);
|
||||
return CPU_USAGE_UNKONW;
|
||||
return CPU_USAGE_UNKNOWN;
|
||||
}
|
||||
|
||||
return GetCpuUsage(first, second);
|
||||
@ -229,22 +229,22 @@ double CpuInfo::GetProcCpuUsage(const std::string& process_name)
|
||||
|
||||
if ((totalTime1 = GetSystemTotalOccupy()) == OHOS::Sensors::ERROR) {
|
||||
SEN_HILOGE("Failed to obtain CPU occupy");
|
||||
return CPU_USAGE_UNKONW;
|
||||
return CPU_USAGE_UNKNOWN;
|
||||
}
|
||||
if ((procTime1 = GetProcOccupy(pid)) == OHOS::Sensors::ERROR) {
|
||||
SEN_HILOGE("Failed to obtain process CPU information");
|
||||
return CPU_USAGE_UNKONW;
|
||||
return CPU_USAGE_UNKNOWN;
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP));
|
||||
|
||||
if ((totalTime2 = GetSystemTotalOccupy()) == OHOS::Sensors::ERROR) {
|
||||
SEN_HILOGE("Failed to obtain CPU occupy");
|
||||
return CPU_USAGE_UNKONW;
|
||||
return CPU_USAGE_UNKNOWN;
|
||||
}
|
||||
if ((procTime2 = GetProcOccupy(pid)) == OHOS::Sensors::ERROR) {
|
||||
SEN_HILOGE("Failed to obtain process CPU information");
|
||||
return CPU_USAGE_UNKONW;
|
||||
return CPU_USAGE_UNKNOWN;
|
||||
}
|
||||
|
||||
return CHK_RATE(CPU_USAGE_MAX * (procTime2 - procTime1) / (totalTime2 - totalTime1));
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Sensors {
|
||||
// These LightId correspand to logical lights
|
||||
// These LightId correspond to logical lights
|
||||
enum LightId {
|
||||
LIGHT_ID_LED = 0,
|
||||
LIGHT_ID_KEYBOARD,
|
||||
|
@ -22,7 +22,7 @@
|
||||
namespace OHOS {
|
||||
namespace Sensors {
|
||||
constexpr int32_t CIRCULAR_BUF_LEN = 1024;
|
||||
constexpr int32_t SENSOR_DATA_LENGHT = 64;
|
||||
constexpr int32_t SENSOR_DATA_LENGTH = 64;
|
||||
|
||||
struct CircularEventBuf {
|
||||
struct SensorData *circularBuf;
|
||||
|
@ -82,7 +82,7 @@ enum GroupBody {
|
||||
};
|
||||
|
||||
struct SensorCombination {
|
||||
SensorGroup sensorCatagory;
|
||||
SensorGroup sensorCategory;
|
||||
uint8_t sensorType;
|
||||
uint8_t sensorIndex;
|
||||
};
|
||||
|
@ -93,7 +93,7 @@ enum {
|
||||
REGIST_CALLBACK_ERR = SET_SENSOR_OPTION_ERR + 1,
|
||||
};
|
||||
|
||||
// Error code for Sensor uitls
|
||||
// Error code for Sensor utils
|
||||
constexpr ErrCode SENSOR_UTILS_ERR_OFFSET = ErrCodeOffset(SUBSYS_SENSORS, MODULE_SENSORS_UTILS);
|
||||
enum {
|
||||
SENSOR_CHANNEL_SOCKET_CREATE_ERR = SENSOR_UTILS_ERR_OFFSET,
|
||||
|
Loading…
x
Reference in New Issue
Block a user