2020-01-08 10:19:01 -08:00
|
|
|
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
|
|
|
|
/*
|
|
|
|
* Copyright 2020 by Eric House (xwords@eehouse.org). All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _DEVICE_H_
|
|
|
|
#define _DEVICE_H_
|
|
|
|
|
|
|
|
#include "dutil.h"
|
|
|
|
|
|
|
|
// void device_load( XW_DUtilCtxt dctxt );
|
|
|
|
# ifdef XWFEATURE_DEVICE
|
2020-05-20 13:58:53 -07:00
|
|
|
void dvc_store( XW_DUtilCtxt* dctxt, XWEnv xwe );
|
2020-01-08 10:19:01 -08:00
|
|
|
# else
|
2020-05-20 13:58:53 -07:00
|
|
|
# define dvc_store(dctxt, xwe)
|
2020-01-08 10:19:01 -08:00
|
|
|
# endif
|
|
|
|
|
2022-12-20 09:20:02 -08:00
|
|
|
typedef void (*MsgAndTopicProc)( void* closure, const XP_UCHAR* topic,
|
2022-12-20 11:55:30 -08:00
|
|
|
const XP_U8* msgBuf, XP_U16 msgLen );
|
2022-12-20 09:20:02 -08:00
|
|
|
|
2020-05-20 13:58:53 -07:00
|
|
|
void dvc_getMQTTDevID( XW_DUtilCtxt* dutil, XWEnv xwe, MQTTDevID* devID );
|
2023-04-26 13:57:21 -07:00
|
|
|
void dvc_setMQTTDevID( XW_DUtilCtxt* dutil, XWEnv xwe, const MQTTDevID* devID );
|
2020-09-13 14:48:36 -07:00
|
|
|
void dvc_resetMQTTDevID( XW_DUtilCtxt* dutil, XWEnv xwe );
|
2022-12-16 13:33:36 -08:00
|
|
|
void dvc_getMQTTSubTopics( XW_DUtilCtxt* dutil, XWEnv xwe,
|
|
|
|
XP_UCHAR* storage, XP_U16 storageLen,
|
|
|
|
XP_U16* nTopics, XP_UCHAR* topics[] );
|
2022-12-20 09:20:02 -08:00
|
|
|
void dvc_makeMQTTInvites( XW_DUtilCtxt* dutil, XWEnv xwe,
|
|
|
|
MsgAndTopicProc proc, void* closure,
|
|
|
|
const MQTTDevID* addressee,
|
2022-12-30 15:33:51 -08:00
|
|
|
const NetLaunchInfo* nli );
|
2023-01-24 17:23:30 -08:00
|
|
|
void dvc_makeMQTTNukeInvite( XW_DUtilCtxt* dutil, XWEnv xwe,
|
|
|
|
MsgAndTopicProc proc, void* closure,
|
|
|
|
const NetLaunchInfo* nli );
|
2022-12-19 19:53:57 -08:00
|
|
|
|
2023-03-17 19:21:57 -07:00
|
|
|
XP_S16 dvc_makeMQTTMessages( XW_DUtilCtxt* dutil, XWEnv xwe,
|
|
|
|
MsgAndTopicProc proc, void* closure,
|
2023-03-18 15:31:20 -07:00
|
|
|
const SendMsgsPacket* const msgs,
|
2023-03-17 19:21:57 -07:00
|
|
|
const MQTTDevID* addressee, XP_U32 gameID,
|
|
|
|
XP_U16 streamVersion );
|
|
|
|
|
2022-12-20 11:55:30 -08:00
|
|
|
void dvc_makeMQTTNoSuchGames( XW_DUtilCtxt* dutil, XWEnv xwe,
|
2023-02-17 08:57:25 -08:00
|
|
|
MsgAndTopicProc proc, void* closure,
|
2022-12-20 11:55:30 -08:00
|
|
|
const MQTTDevID* addressee,
|
2023-02-17 08:57:25 -08:00
|
|
|
XP_U32 gameID );
|
2022-12-16 13:33:36 -08:00
|
|
|
void dvc_parseMQTTPacket( XW_DUtilCtxt* dutil, XWEnv xwe, const XP_UCHAR* topic,
|
|
|
|
const XP_U8* buf, XP_U16 len );
|
2024-02-13 14:38:52 -08:00
|
|
|
|
2024-02-15 08:54:48 -08:00
|
|
|
void dvc_onWebSendResult( XW_DUtilCtxt* dutil, XWEnv xwe, XP_U32 resultKey,
|
|
|
|
XP_Bool succeeded, const XP_UCHAR* result );
|
|
|
|
|
2024-02-13 14:38:52 -08:00
|
|
|
/* All platforms need to call this shortly after setting up their XW_DUtilCtxt */
|
|
|
|
void dvc_init( XW_DUtilCtxt* dutil, XWEnv xwe );
|
2024-02-15 16:48:14 -08:00
|
|
|
void dvc_cleanup( XW_DUtilCtxt* dutil, XWEnv xwe );
|
2024-02-13 14:38:52 -08:00
|
|
|
|
2020-01-08 10:19:01 -08:00
|
|
|
#endif
|