• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef P2PLINK_LOOP_H
17 #define P2PLINK_LOOP_H
18 
19 #include <stdint.h>
20 typedef enum {
21     P2PLOOP_MSG_PROC,
22     P2PLOOP_MSG_TEST,
23     START_NEGOTIATION,
24     CONN_REQUEST_TIME_OUT,
25     WAIT_CONN_TIME_OUT,
26     MAGICLINK_CONN_GROUP_TIME_OUT,
27     MAGICLINK_CREATE_GROUP_TIME_OUT,
28     MAGICLINK_ON_GROUP_CHANGED,
29     CONN_REQUEST_FAILED,
30     MAGICLINK_ON_CONNECTED,
31     CONN_REQUEST,
32     CONN_RESPONSE,
33     CONN_RESPONSE_FAILED,
34     P2PLOOP_CONNINGDEV_TIMER,
35     P2PLOOP_P2PAUTHCHAN_OK,
36     P2PLOOP_BROADCAST_GROUPSTATE_CHANGED,
37     P2PLOOP_BROADCAST_P2PSTATE_CHANGED,
38     P2PLOOP_BROADCAST_CONN_STATE,
39     P2PLOOP_INTERFACE_ROLE_CONFICT,
40     P2PLOOP_INTERFACE_LOOP_DISCONNECT,
41     P2PLOOP_INTERFACE_LOOP_CONNECT,
42     P2PLOOP_OPEN_AUTH_CHAN,
43     P2PLOOP_OPEN_DISCONNECTING_TIMEOUT,
44     WAIT_ROLE_NEG_TIME_OUT,
45     DHCP_TIME_OUT,
46 } P2pLoopMsg;
47 
48 typedef void (*P2pLoopProcessFunc)(P2pLoopMsg msgType, void *para);
49 
50 int32_t P2pLoopInit(void);
51 int32_t P2pLoopProc(P2pLoopProcessFunc callback, void *para, P2pLoopMsg msgType); // para: no use local variable
52 int32_t P2pLoopProcDelay(P2pLoopProcessFunc callback, void *para, uint64_t delayMillis, P2pLoopMsg msgType);
53 int32_t P2pLoopProcDelayDel(P2pLoopProcessFunc callback, P2pLoopMsg msgType);
54 
55 #endif
56 
57