<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> from rpc4django import rpcmethod <EOL> import logging <EOL> from services . accounts import models as account_models <EOL> from services . configuration . models import segments as segment_models <EOL> from services . configuration . jrpc . serializers import segments as segment_serializers <EOL> from website import settings as satnet_settings <EOL> logger = logging . getLogger ( '<STR_LIT>' ) <EOL> @ rpcmethod ( <EOL> name = '<STR_LIT>' , <EOL> signature = [ ] , <EOL> login_required = satnet_settings . JRPC_LOGIN_REQUIRED <EOL> ) <EOL> def list_groundstations_mine ( ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> user , username = account_models . get_user ( <EOL> http_request = kwargs . get ( '<STR_LIT>' , None ) <EOL> ) <EOL> return [ <EOL> str ( s . identifier ) for s in segment_models . GroundStation . objects . filter ( <EOL> user = user <EOL> ) <EOL> ] <EOL> @ rpcmethod ( <EOL> name = '<STR_LIT>' , <EOL> signature = [ ] , <EOL> login_required = satnet_settings . JRPC_LOGIN_REQUIRED <EOL> ) <EOL> def list_groundstations_others ( ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> user , username = account_models . get_user ( <EOL> http_request = kwargs . get ( '<STR_LIT>' , None ) <EOL> ) <EOL> return [ <EOL> str ( s . identifier ) for s in segment_models . GroundStation . objects . exclude ( <EOL> user = user <EOL> ) <EOL> ] <EOL> @ rpcmethod ( <EOL> name = '<STR_LIT>' , <EOL> signature = [ ] , <EOL> login_required = satnet_settings . JRPC_LOGIN_REQUIRED <EOL> ) <EOL> def list_groundstations ( ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> return [ <EOL> str ( g . identifier ) for g in segment_models . GroundStation . objects . all ( ) <EOL> ] <EOL> @ rpcmethod ( <EOL> name = '<STR_LIT>' , <EOL> signature = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> login_required = satnet_settings . JRPC_LOGIN_REQUIRED <EOL> ) <EOL> def create ( identifier , callsign , elevation , latitude , longitude , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> user , username = account_models . get_user ( <EOL> http_request = kwargs . get ( '<STR_LIT>' , None ) <EOL> ) <EOL> gs = segment_models . GroundStation . objects . create ( <EOL> latitude = latitude , <EOL> longitude = longitude , <EOL> identifier = identifier , <EOL> callsign = callsign , <EOL> contact_elevation = elevation , <EOL> username = username <EOL> ) <EOL> return { <EOL> segment_serializers . GS_ID_K : str ( gs . identifier ) <EOL> } <EOL> @ rpcmethod ( <EOL> name = '<STR_LIT>' , <EOL> signature = [ '<STR_LIT>' ] , <EOL> login_required = satnet_settings . JRPC_LOGIN_REQUIRED <EOL> ) <EOL> def get_configuration ( ground_station_id ) : <EOL> """<STR_LIT>""" <EOL> return segment_serializers . serialize_gs_configuration ( <EOL> segment_models . GroundStation . objects . get ( identifier = ground_station_id ) <EOL> ) <EOL> @ rpcmethod ( <EOL> name = '<STR_LIT>' , <EOL> signature = [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> login_required = satnet_settings . JRPC_LOGIN_REQUIRED <EOL> ) <EOL> def set_configuration ( ground_station_id , configuration ) : <EOL> """<STR_LIT>""" <EOL> callsign , contact_elevation , latitude , longitude = segment_serializers . deserialize_gs_configuration ( configuration ) <EOL> gs = segment_models . GroundStation . objects . get ( identifier = ground_station_id ) <EOL> gs . update ( <EOL> callsign = callsign , contact_elevation = contact_elevation , <EOL> latitude = latitude , longitude = longitude <EOL> ) <EOL> return ground_station_id <EOL> @ rpcmethod ( <EOL> name = '<STR_LIT>' , <EOL> signature = [ '<STR_LIT>' ] , <EOL> login_required = satnet_settings . JRPC_LOGIN_REQUIRED <EOL> ) <EOL> def delete ( ground_station_id ) : <EOL> """<STR_LIT>""" <EOL> segment_models . GroundStation . objects . get ( <EOL> identifier = ground_station_id <EOL> ) . delete ( ) <EOL> return ground_station_id </s>
