Method for using cellular communication function, and related apparatus and system
This application relates to the field of cellular communication technologies, and discloses a method for using cellular communication, and a related apparatus and system, whose objective is to share all cellular communication functions of a second device with a first device for use. The distributed cellular communication module of the first device forwards a received cellular communication service request to the second device, and then receives response data corresponding to the cellular communication service request and returned by the distributed cellular communication module of the second device, where the response data corresponding to the cellular communication service request is obtained by performing processing by a Modem of the second device, and then the first device uses the Modem of the second device to process all cellular communication service requests of the first device, to have all cellular communication capabilities of the second device.
1 . A method, performed by a first device, comprising:
preconfiguring an operation function of a distributed cellular communication module of a first device, wherein the operation function comprises forwarding a received cellular communication service request to a function configuration of a distributed cellular communication module of a second device;
establishing a connection to the distributed cellular communication module of the second device;
sending a cellular communication capability sharing request to the distributed cellular communication module of the second device;
creating a proxy object of a request interface, and sending the cellular communication capability sharing request to the distributed cellular communication module of the second device, wherein the proxy object of the request interface is used for forwarding the received cellular communication service request to the distributed cellular communication module of the second device;
triggering a local telephony manager to send a subscriber identity module state query request;
sending the subscriber identity module state query request sent by the local telephony manager to the distributed cellular communication module of the second device;
receiving a subscriber identity module state query result returned by the distributed cellular communication module of the second device, wherein the subscriber identity module state query result is obtained by sending the subscriber identity module state query request to a modem of the second device by the distributed cellular communication module of the second device and processing the subscriber identity module state query request by the modem of the second device;
sending the subscriber identity module state query result to an application corresponding to the subscriber identity module state query result;
receiving, by the distributed cellular communication module of the first device, a cellular communication service request that corresponds to an application of the first device, wherein the distributed cellular communication module is run in a system service or arranged in an application framework layer or a system library of the first device;
forwarding the received cellular communication service request to the distributed cellular communication module of the second device, wherein the distributed cellular communication module of the second device is run in a system service or arranged in an application framework layer or a system library of the second device;
receiving, by the distributed cellular communication module of the first device, response data corresponding to the cellular communication service request and returned by the distributed cellular communication module of the second device, wherein the response data corresponding to the cellular communication service request is obtained by sending the cellular communication service request to a modem of the second device by the distributed cellular communication module of the second device and processing the cellular communication service request by the modem of the second device; and
sending the response data corresponding to the cellular communication service request to the application corresponding to the cellular communication service request.
2 . The method according to claim 1 , wherein before establishing the connection to the second device, the method further comprises:
querying a device enabling a cellular communication capability sharing function in a network; and
selecting the second device from all queried devices enabling the cellular communication capability sharing function.
3 . The method according to claim 1 , wherein establishing the connection to the second device comprises:
sending a socket connection request to the distributed cellular communication module of the second device; and
establishing the connection to the distributed cellular communication module of the second device through a distributed bus in a case that the distributed cellular communication module of the second device successfully responds to the socket connection request; or
establishing the connection as a persistent connection channel through a communication service cloud, wherein the persistent connection channel is used for connecting the distributed cellular communication module of the first device and the distributed cellular communication module of the second device.
4 . The method according to claim 1 , wherein after creating the proxy object of the request interface, the method further comprises:
disabling the proxy object of the request interface in response to the second device disabling a cellular communication capability sharing function; or sending a sharing ending request to the distributed cellular communication module of the second device and disabling the proxy object of the request interface.
5 . The method according to claim 1 , wherein before forwarding the received cellular communication service request to the distributed cellular communication module of the second device, the method further comprises:
recognizing whether the received cellular communication service request needs to be forwarded to the second device;
sending, in a case that the received cellular communication service request does not need to be forwarded to the second device, the cellular communication service request to a local modem for processing;
receiving the response data corresponding to the cellular communication service request and sent by the local modem; and
sending the response data corresponding to the cellular communication service request to the application corresponding to the cellular communication service request, wherein
forwarding the received cellular communication service request to the distributed cellular communication module of the second device comprises:
forwarding the cellular communication service request to the distributed cellular communication module of the second device in a case of recognizing that the cellular communication service request needs to be forwarded to the second device.
6 . The method according to claim 1 , further comprising:
receiving a cellular communication service notification returned by the distributed cellular communication module of the second device; and
sending the cellular communication service notification to an application corresponding to the cellular communication service request.
7 . The method according to claim 1 , wherein forwarding the received cellular communication service request to the distributed cellular communication module of the second device comprises:
performing packet assembly and serialization processing on the received cellular communication service request; and
forwarding the processed cellular communication service request to the distributed cellular communication module of the second device, wherein
before sending the response data corresponding to the cellular communication service request to the application corresponding to the cellular communication service request, the method further comprises:
performing packet disassembly and deserialization processing on the response data corresponding to the cellular communication service request; and
wherein sending the response data corresponding to the cellular communication service request to the application corresponding to the cellular communication service request comprises:
sending the processed response data corresponding to the cellular communication service request to an application corresponding to the cellular communication service request.
8 . A first device, comprising
memory and one or more processors, the one or more processors configured to execute instructions stored on the memory to cause the first device to:
preconfigure an operation function of a distributed cellular communication module of the first device, wherein the operation function comprises forwarding a received cellular communication service request to a function configuration of a distributed cellular communication module of a second device;
establish a connection to the distributed cellular communication module of the second device;
send a cellular communication capability sharing request to the distributed cellular communication module of the second device;
create a proxy object of a request interface, and sending the cellular communication capability sharing request to the distributed cellular communication module of the second device, wherein the proxy object of the request interface is used for forwarding the received cellular communication service request to the distributed cellular communication module of the second device;
disable the proxy object of the request interface in response to that the second device disables a cellular communication capability sharing function; or send a sharing ending request to the distributed cellular communication module of the second device and disable the proxy object of the request interface;
receive, by the distributed cellular communication module of the first device, a cellular communication service request that corresponds to an application of the first device, wherein the distributed cellular communication module is run in a system service or arranged in an application framework layer or a system library of the first device;
forward the received cellular communication service request to the distributed cellular communication module of a second device, wherein the distributed cellular communication module of the second device is run in a system service or arranged in an application framework layer or a system library of the second device;
receive, by the distributed cellular communication module of the first device, response data corresponding to the cellular communication service request and returned by the distributed cellular communication module of the second device, wherein the response data corresponding to the cellular communication service request is obtained by sending the cellular communication service request to a modem of the second device by the distributed cellular communication module of the second device and processing the cellular communication service request by the modem of the second device; and
send the response data corresponding to the cellular communication service request to the application corresponding to the cellular communication service request.
9 . The first electronic device according to claim 8 , wherein the first device is further to perform a configuration of using the modem of the second device in advance, the configuration comprising to:
preconfigure an operation function of the distributed cellular communication module of the first device, wherein the operation function of the distributed cellular communication module of the first device is a function of forwarding the received cellular communication service request to a function configuration of the distributed cellular communication module of the second device;
establish a connection to the distributed cellular communication module of the second device; and
send a cellular communication capability sharing request to the distributed cellular communication module of the second device.
10 . The first device according to claim 8 , wherein after creating the proxy object of the request interface, the first device is further to:
trigger a local telephony manager to send a subscriber identity module state query request;
send the subscriber identity module state query request sent by the local telephony manager to the distributed cellular communication module of the second device;
receive a subscriber identity module state query result returned by the distributed cellular communication module of the second device, wherein the subscriber identity module state query result is obtained by sending the subscriber identity module state query request to the modem of the second device by the distributed cellular communication module of the second device and processing the subscriber identity module state query request by the modem of the second device; and
send the subscriber identity module state query result to an application corresponding to the subscriber identity module state query result.
11 . The first device according to claim 8 , wherein the first device is further to, before establishing the connection to the second device;
query a device enabling a cellular communication capability sharing function in a network; and
select the second device from all queried devices enabling the cellular communication capability sharing function.
12 . The first device according to claim 8 , wherein to establish the connection to the second device comprises to:
send a socket connection request to the distributed cellular communication module of the second device; and
establish the connection to the distributed cellular communication module of the second device through a distributed bus in a case that the distributed cellular communication module of the second device successfully responds to the socket connection request; or
establish the connection with a persistent connection channel through a communication service cloud, wherein the persistent connection channel is used for connecting the distributed cellular communication module of the first device and the distributed cellular communication module of the second device.
13 . The first device according to claim 8 , wherein the first device is further to, before the forwarding the received cellular communication service request to the distributed cellular communication module of the second device;
recognize whether the received cellular communication service request needs to be forwarded to the second device;
send, in a case that the received cellular communication service request does not need to be forwarded to the second device, the cellular communication service request to a local modem for processing;
receive the response data corresponding to the cellular communication service request and sent by the local modem; and
send the response data corresponding to the cellular communication service request to the application corresponding to the cellular communication service request, wherein
to forward the received cellular communication service request to the distributed cellular communication module of the second device comprises to:
forward the cellular communication service request to the distributed cellular communication module of the second device in a case of recognizing that the cellular communication service request needs to be forwarded to the second device.
14 . The first device according to claim 8 , wherein the first device is further to:
receive a cellular communication service notification returned by the distributed cellular communication module of the second device; and
send the cellular communication service notification to an application corresponding to the cellular communication service request.
15 . The first device according to claim 8 , wherein to forward the received cellular communication service request to the distributed cellular communication module of the second device comprises to:
perform packet assembly and serialization processing on the received cellular communication service request; and
forward the processed cellular communication service request to the distributed cellular communication module of the second device, wherein
before sending the response data corresponding to the cellular communication service request to the application corresponding to the cellular communication service request, the first device is further to:
perform packet disassembly and deserialization processing on the response data corresponding to the cellular communication service request; and
wherein sending the response data corresponding to the cellular communication service request to the application corresponding to the cellular communication service request comprises to:
send the processed response data corresponding to the cellular communication service request to an application corresponding to the cellular communication service request.
16 . A non-transitory computer readable medium storing instructions that, when executed by one or more processors of a first device, causes the first device to:
receive, by a distributed cellular communication module of the first device, a cellular communication service request that corresponds to an application of the first device, wherein the distributed cellular communication module is run in a system service or arranged in an application framework layer or a system library of the first device;
recognize whether the received cellular communication service request needs to be forwarded to a second device;
in a case that the received cellular communication service request does not need to be forwarded to the second device,
send the cellular communication service request to a local modem for processing,
receive response data corresponding to the cellular communication service request and sent by the local modem, and
send the response data corresponding to the cellular communication service request to the application corresponding to the cellular communication service request; and
in a case of recognizing that the cellular communication service request needs to be forwarded to the second device,
forward the received cellular communication service request to a distributed cellular communication module of the second device, wherein the distributed cellular communication module of the second device is run in a system service or arranged in an application framework layer or a system library of the second device,
receive, by the distributed cellular communication module of the first device, the response data corresponding to the cellular communication service request and returned by the distributed cellular communication module of the second device, wherein the response data corresponding to the cellular communication service request is obtained by sending the cellular communication service request to a modem of the second device by the distributed cellular communication module of the second device and processing the cellular communication service request by the modem of the second device, and
send the response data corresponding to the cellular communication service request to the application corresponding to the cellular communication service request.
17 . A method, performed by a first device, comprising:
receiving, by a distributed cellular communication module of the first device, a cellular communication service request that corresponds to an application of the first device, wherein the distributed cellular communication module is run in a system service or arranged in an application framework layer or a system library of the first device;
forwarding the received cellular communication service request to a distributed cellular communication module of a second device, wherein the distributed cellular communication module of the second device is run in a system service or arranged in an application framework layer or a system library of the second device, and wherein forwarding the received cellular communication service request to the distributed cellular communication module of the second device comprises performing packet assembly and serialization processing on the received cellular communication service request and forwarding the processed cellular communication service request to the distributed cellular communication module of the second device,
receiving, by the distributed cellular communication module of the first device, response data corresponding to the cellular communication service request and returned by the distributed cellular communication module of the second device, wherein the response data corresponding to the cellular communication service request is obtained by sending the cellular communication service request to a modem of the second device by the distributed cellular communication module of the second device and processing the cellular communication service request by the modem of the second device;
performing packet disassembly and deserialization processing on the response data corresponding to the cellular communication service request; and
sending the processed response data corresponding to the cellular communication service request to the application corresponding to the cellular communication service request.