mirror of
https://github.com/openharmony/tools_previewer.git
synced 2026-07-01 20:44:05 -04:00
add util part 3 and modify warns
Signed-off-by: libenyao <libenyao@h-partners.com>
This commit is contained in:
+6
-3
@@ -943,7 +943,8 @@ void ChargeModeCommand::RunGet()
|
||||
|
||||
void ChargeModeCommand::RunSet()
|
||||
{
|
||||
SharedData<uint8_t>::SetData(SharedDataType::BATTERY_STATUS, static_cast<uint8_t>(atoi(args["ChargeMode"].asString().data())));
|
||||
SharedData<uint8_t>::SetData(SharedDataType::BATTERY_STATUS,
|
||||
static_cast<uint8_t>(atoi(args["ChargeMode"].asString().data())));
|
||||
Json::Value result = true;
|
||||
SetCommandResult("result", result);
|
||||
ILOG("Set chargeMode run finished, the value is: %s", args["ChargeMode"].asString().c_str());
|
||||
@@ -1022,7 +1023,8 @@ void HeartRateCommand::RunGet()
|
||||
|
||||
void HeartRateCommand::RunSet()
|
||||
{
|
||||
SharedData<uint8_t>::SetData(SharedDataType::HEARTBEAT_VALUE, static_cast<uint8_t>(atoi(args["HeartRate"].asString().data())));
|
||||
SharedData<uint8_t>::SetData(SharedDataType::HEARTBEAT_VALUE,
|
||||
static_cast<uint8_t>(atoi(args["HeartRate"].asString().data())));
|
||||
Json::Value result = true;
|
||||
SetCommandResult("result", result);
|
||||
ILOG("Set heartRate run finished, the value is: %s", args["HeartRate"].asString().c_str());
|
||||
@@ -1065,7 +1067,8 @@ void StepCountCommand::RunGet()
|
||||
|
||||
void StepCountCommand::RunSet()
|
||||
{
|
||||
SharedData<uint32_t>::SetData(SharedDataType::SUMSTEP_VALUE, static_cast<uint32_t>(atoi(args["StepCount"].asString().data())));
|
||||
SharedData<uint32_t>::SetData(SharedDataType::SUMSTEP_VALUE,
|
||||
static_cast<uint32_t>(atoi(args["StepCount"].asString().data())));
|
||||
Json::Value result = true;
|
||||
SetCommandResult("result", result);
|
||||
ILOG("Set stepCount run finished, the value is: %s", args["StepCount"].asString().c_str());
|
||||
|
||||
@@ -20,6 +20,8 @@ using namespace std;
|
||||
uint32_t PublicMethods::Ulltoa(uintptr_t value, int8_t (&rstStr)[MAX_ITOA_BIT])
|
||||
{
|
||||
const int32_t RADIX_HEXADECIMAL = 16;
|
||||
const int32_t dividendLength = 10;
|
||||
|
||||
|
||||
auto remainder = value;
|
||||
int8_t strSpace[MAX_ITOA_BIT] = {0};
|
||||
@@ -30,10 +32,10 @@ uint32_t PublicMethods::Ulltoa(uintptr_t value, int8_t (&rstStr)[MAX_ITOA_BIT])
|
||||
rstLength++;
|
||||
dividend = remainder % RADIX_HEXADECIMAL;
|
||||
remainder = remainder / RADIX_HEXADECIMAL;
|
||||
if (dividend < 10) { // Converted to hexadecimal
|
||||
if (dividend < dividendLength) { // Converted to hexadecimal
|
||||
*curPoint++ = dividend + '0';
|
||||
} else {
|
||||
*curPoint++ = dividend + 'a' - 10;
|
||||
*curPoint++ = dividend + 'a' - dividendLength;
|
||||
}
|
||||
}
|
||||
int8_t* tmpRstStr = rstStr;
|
||||
|
||||
Reference in New Issue
Block a user