Home > other >  Python can implement the following functions
Python can implement the following functions

Time:11-21

Host a Linux platform, kept in memory for such a information

 

//header files define the enumeration
Enum data_type
{
Type_uint8=0 x20,
Type_uint16=0 x21,
X22 type_uint32=0,
Type_string=0 x42,
}
//header files define structure
Strcut attr
{
UINT16 ID;
Enum data_type type;
The union
{
UINT8 data8;
UINT16 data16;
UINT32 data32;
UINT8 dataStr [32].
}
} attr_st;


//gateway information saved in the database
Struct attr_st attrArray [6]=
{
{0 x0000, type_uint8. Data8=0 x12},
{0 x0001 type_uint16,. The data16=0 x1234},
{0 x0002, type_uint32. Data32=0 x12345678},
{0 x0003, type_string, dataStr="I 'm a Light"},
{0 x0004, type_uint16,. The data16=0 x00000011},
{0 x0005, type_string, dataStr="A li ba ba"},
};



Mobile phone APP using json and host communication

Mobile phone APP, install a plug-in, plug-in contains these important information

Variable1 {NAME="switch state," ID=0 x0000, type=type_uint8}
Variable2 {NAME="brightness", ID=0 x0001, type=type_uint16}
Variable3 {NAME="production date", ID=0 x0002, type=type_uint32}
Variable4 {NAME="product model", ID=0 x0003, type=type_string}
Variable5 {NAME="firmware version," ID=0 x0004, type_uint16}
Variable6 {NAME="manufacturers," ID=0 x0005, type=type_string}
Variable7 {NAME="manufacturer's home page," ID=0 x0006, type=type_string}

Mobile phone APP on the interface of this a few function
1, access to the switch state
2, get brightness
3, to obtain product model
4, get manufacturers
5, access to the manufacturer home page

Question:
1, use the Python whether can realize the function of APP on the plugin?
2, after the phone APP running Python plug-in, interface automatic loading plug-ins described in the interface,
3 APP, in accordance with the plug-in described, packaged with Linux host json, obtain the needed parameters, from Linux host
4, note that there is no "ID=0 x0006" in Linux host data, then the APP interface generation, "access to the manufacturer home page a" should be displayed as gray, if the phone connects another Linux host, the host data has {0 x0006, type_string,. DataStr="www.csdn.net"} this term, mobile phone interface has the button "access to the manufacturer home page",












CodePudding user response:

Apple or Google add plug-in does not support the app, because this will avoid platform review/test

In a train of thought, the server generates HTML even pictures, sent to the app

CodePudding user response:

reference 1st floor tianfang response:
apple or Google add plug-in does not support the app, because this will avoid platform review/test

In a train of thought, on the server to generate HTML or even pictures, sent to the app


Which contains the source code of the plugin? APP to control all kinds of intelligent devices, such as the control light is light on and off of the interface and brightness, the sensor has the temperature display, humidity display interface, intelligent equipment there are all kinds of communication mode, but the devices to each relay equipment to APP, data are passthrough, APP in the plug-in, with the help of analytical data stream what represent temperature, what represents the humidity, what represents the brightness, middle the forwarding devices do not need to do any escape and parsing operations,

CodePudding user response:

Plug-ins are executable scripts that need app contains an actuator

Your this requirement, the implementation ways are:
1 device, the data format known, directly in the app just write big deal one day a version,
2 server provides an interface translation data
3 add metadata to describe treatment, increasing the new equipment is a metadata description, the app based on metadata description, parse and display the data
  • Related