71 lines
2.3 KiB
Objective-C
71 lines
2.3 KiB
Objective-C
//
|
|
// XSPhoneInfo.h
|
|
// nochange
|
|
//
|
|
// Created by mac on 2024/10/15.
|
|
//
|
|
|
|
#ifndef XSPhoneInfo_h
|
|
#define XSPhoneInfo_h
|
|
|
|
#import <ifaddrs.h> // 获取ip
|
|
#import <arpa/inet.h> // 获取ip
|
|
#import <net/if.h> // 获取ip
|
|
#import <net/if_dl.h>
|
|
|
|
@interface XSPhoneInfo : NSObject
|
|
|
|
// 基本电池信息
|
|
@property (nonatomic, assign, readonly) float batteryLevel; // 当前电量百分比
|
|
@property (nonatomic, assign, readonly) BOOL isFullyCharged; // 是否充满
|
|
@property (nonatomic, assign, readonly) float batteryVoltage; // 电压 (mV)
|
|
@property (nonatomic, assign, readonly) float maxCapacity; // 最大容量 (mAh)
|
|
@property (nonatomic, assign, readonly) float currentCapacity; // 当前容量 (mAh)
|
|
@property (nonatomic, assign, readonly) float designCapacity; // 设计容量 (mAh)
|
|
@property (nonatomic, assign, readonly) NSInteger cycleCount; // 充电次数
|
|
@property (nonatomic, assign, readonly) NSInteger batteryHealth; // 电池健康度 (%)
|
|
@property (nonatomic, assign, readonly) BOOL isCharging; // 是否在充电
|
|
@property (nonatomic, copy, readwrite) NSString *batteryStatus;
|
|
@property (nonatomic, assign, readonly) float temperature; // 电池温度
|
|
@property (nonatomic, assign, readonly) float voltage; // 电池电压
|
|
|
|
@property (nonatomic, assign, readonly) double totalMemory; // 总内存(GB)
|
|
@property (nonatomic, assign, readonly) double availableMemory; // 可用内存(GB)
|
|
@property (nonatomic, assign, readonly) double usedMemory; // 已用内存(GB)
|
|
@property (nonatomic, assign, readonly) float memoryUsage; // 内存使用率(%)
|
|
@property (nonatomic, assign, readonly) vm_size_t pageSize; // 内存页大小
|
|
|
|
@property (nonatomic, copy, readwrite) NSString *remoteIp;
|
|
|
|
+(instancetype)sharedInstance;
|
|
|
|
|
|
- (NSString *)IPAddress;
|
|
|
|
- (NSString *)DiskSize;
|
|
|
|
// 开始监控电池
|
|
- (void)startBatteryMonitoring;
|
|
|
|
// 停止监控电池
|
|
- (void)stopBatteryMonitoring;
|
|
|
|
// 获取详细电池信息
|
|
- (NSDictionary *)getBatteryInfo;
|
|
|
|
// 获取当前内存状态
|
|
- (void)updateMemoryInfo;
|
|
|
|
|
|
|
|
// 获取指定进程内存使用
|
|
- (double)getMemoryUsageForPid:(pid_t)pid;
|
|
|
|
// 监控内存使用
|
|
- (void)startMemoryMonitoring;
|
|
- (void)stopMemoryMonitoring;
|
|
- (NSString *)IPhoneStatus;
|
|
@end
|
|
|
|
#endif /* XSPhoneInfo_h */
|