1*cf78ab8cSAndroid Build Coastguard Worker# Netsim python gRPC library 2*cf78ab8cSAndroid Build Coastguard Worker 3*cf78ab8cSAndroid Build Coastguard WorkerThis contains a python library to interact with Netsim gRPC frontend service 4*cf78ab8cSAndroid Build Coastguard Worker 5*cf78ab8cSAndroid Build Coastguard Worker## Development 6*cf78ab8cSAndroid Build Coastguard Worker 7*cf78ab8cSAndroid Build Coastguard WorkerIf you wish to do development you can create a virtual environment and 8*cf78ab8cSAndroid Build Coastguard Workergenerate python files from .proto files by running: 9*cf78ab8cSAndroid Build Coastguard Worker 10*cf78ab8cSAndroid Build Coastguard Worker . ./configure.sh 11*cf78ab8cSAndroid Build Coastguard Worker 12*cf78ab8cSAndroid Build Coastguard Worker## Usage 13*cf78ab8cSAndroid Build Coastguard Worker 14*cf78ab8cSAndroid Build Coastguard WorkerNetsimClient() is the Netsim gRPC Frontend Client Service connecting to netsim daemon. 15*cf78ab8cSAndroid Build Coastguard WorkerUsers should use a NetsimClient to interact with netsim daemon by calling the provided APIs. 16*cf78ab8cSAndroid Build Coastguard Worker 17*cf78ab8cSAndroid Build Coastguard Worker```python 18*cf78ab8cSAndroid Build Coastguard Workerfrom netsim import netsim 19*cf78ab8cSAndroid Build Coastguard Worker 20*cf78ab8cSAndroid Build Coastguard Workernetsim_client = netsim.NetsimClient() 21*cf78ab8cSAndroid Build Coastguard Workerdevices = netsim_client.get_devices() 22*cf78ab8cSAndroid Build Coastguard Worker``` 23*cf78ab8cSAndroid Build Coastguard Worker 24*cf78ab8cSAndroid Build Coastguard WorkerThe currently supported APIs include: 25*cf78ab8cSAndroid Build Coastguard Worker- `get_version()`: Get the version of the netsim daemon. 26*cf78ab8cSAndroid Build Coastguard Worker- `get_devices()`: Get detailed information for all devices connected to netsim daemon. 27*cf78ab8cSAndroid Build Coastguard Worker- `set_position()`: Set the position and/or orientation of the specified device. 28*cf78ab8cSAndroid Build Coastguard Worker- `set_radio()`: Set the specified radio chip's state of the specified device. 29*cf78ab8cSAndroid Build Coastguard Worker- `reset()`: Reset all devices. 30*cf78ab8cSAndroid Build Coastguard Worker 31*cf78ab8cSAndroid Build Coastguard Worker## Adding dependencies 32*cf78ab8cSAndroid Build Coastguard Worker 33*cf78ab8cSAndroid Build Coastguard WorkerConfigure will use the local python interpreter, which does not 34*cf78ab8cSAndroid Build Coastguard Workerhave TLS support, so all the package must be made available locally! 35*cf78ab8cSAndroid Build Coastguard Worker 36*cf78ab8cSAndroid Build Coastguard WorkerIf you need to add a package, make the source package available under the 37*cf78ab8cSAndroid Build Coastguard Workerrepo directory. The easiest way to do this is: 38*cf78ab8cSAndroid Build Coastguard Worker 39*cf78ab8cSAndroid Build Coastguard Worker pip3 install pip2pi 40*cf78ab8cSAndroid Build Coastguard Worker pip3 download --no-binary ":all:" my-package=1.2.3 -d repo 41*cf78ab8cSAndroid Build Coastguard Worker dir2pi repo