Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
doronz88 committed Mar 8, 2022
1 parent f88385c commit 3daa1e3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@ This project includes two components:

The python client utilizes the ability to call native functions in order to provide APIs for different aspects:

* Remote shell commands
* Filesystem management (APIs for `open()`, `read()`, etc...)
* Network management (WiFi scan, TCP connect, etc...)
* Remote shell commands (`p.spawn()`)
* Filesystem management (`p.fs.*`)
* Network management (WiFi scan, TCP connect, etc...) (`p.network.*`)
* Darwin only:
* Multimedia automation (recording and playing)
* Preferences managemnent (remote manage CFPreference and SCPreferences)
* Process management (kill, list, query open FDs, etc...)
* Multimedia automation (recording and playing) (`p.media.*`)
* Preferences managemnent (remote manage CFPreference and SCPreferences) (`p.preferences.*`)
* Process management (kill, list, query open FDs, etc...) (`p.processes`)
* Location services (`p.location.*`)
* HID simulation (`p.hid.*`)
* IORegistry API (`p.ioregistry.*`)
* Reports management (Logs and Crash Reports) (`p.reports.*`)
* Time settings (`p.time.*`)
* iOS Only:
* MobileGestalt (`p.mobile_gestalt.*`)
* Backlight adjusting (`p.backlight.*`)

and much more...

## Building C Server

Expand All @@ -32,7 +42,7 @@ cd src/rpcserver
make
```

On iOS:
On iOS (Make sure to have XCode installed):

```shell
git clone [email protected]:doronz88/rpc-project.git
Expand Down
7 changes: 6 additions & 1 deletion src/rpcclient/rpcclient/darwin/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,17 @@ def _load_location_library(self):

@property
def location_services_enabled(self) -> bool:
""" opt-in status for location services """
return bool(self._location_manager.objc_call('locationServicesEnabled'))

@location_services_enabled.setter
def location_services_enabled(self, value: bool):
""" opt-in status for location services """
self._CLLocationManager.objc_call('setLocationServicesEnabled:', value)

@property
def authorization_status(self) -> CLAuthorizationStatus:
""" authorization status for current server process of accessing location services """
return CLAuthorizationStatus.from_value(self._location_manager.objc_call('authorizationStatus'))

@property
Expand All @@ -66,15 +69,17 @@ def last_sample(self) -> Optional[Mapping]:
return location.objc_call('jsonObject').py

def start_updating_location(self):
""" request location updates from CLLocationManager """
if self.authorization_status.value < CLAuthorizationStatus.kCLAuthorizationStatusAuthorizedAlways.value:
raise PermissionDeniedError()
self._location_manager.objc_call('startUpdatingLocation')

def stop_updating_location(self):
""" stop requesting location updates from CLLocationManager """
self._location_manager.objc_call('stopUpdatingLocation')

def request_oneshot_location(self):
""" Requests the one-time delivery of the user’s current location. """
""" requests the one-time delivery of the user’s current location """
if self.authorization_status.value < CLAuthorizationStatus.kCLAuthorizationStatusAuthorizedAlways.value:
raise PermissionDeniedError()
self._location_manager.objc_call('requestLocation')
6 changes: 5 additions & 1 deletion src/rpcclient/rpcclient/darwin/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,25 @@ def _load_core_time_framework(self):
return
raise MissingLibraryError('failed to load CoreTime')

def now(self):
def now(self) -> datetime:
""" get current time """
with self._client.safe_calloc(timeval.sizeof()) as current:
self._client.symbols.gettimeofday(current, 0)
time_of_day = timeval.parse(current.peek(timeval.sizeof()))
return datetime.fromtimestamp(time_of_day.tv_sec + (time_of_day.tv_usec / (10 ** 6)))

def set_current(self, new_time: datetime):
""" set current time """
self._client.symbols.TMSetAutomaticTimeZoneEnabled(0)
with self._client.safe_calloc(timeval.sizeof()) as current:
current.poke(timeval.build({'tv_sec': int(new_time.timestamp()), 'tv_usec': new_time.microsecond}))
self._client.symbols.settimeofday(current, 0)

def set_auto(self):
""" opt-in automatic time settings """
self._client.symbols.TMSetAutomaticTimeZoneEnabled(1)

@property
def is_set_automatically(self):
""" tell is time settings are set to automatic """
return bool(self._client.symbols.TMIsAutomaticTimeZoneEnabled())

0 comments on commit 3daa1e3

Please sign in to comment.