func (communication *Wrapper) SendPing() common.SyncServiceError {
	comm, err := communication.selectCommunicator(common.Configuration.CommunicationProtocol, "", "", "")
	if err != nil {
		return err
	}
	return comm.SendPing()
}
SendPing sends a ping message from ESS to CSS
package communications
import (
	"time"
	"github.com/open-horizon/edge-sync-service/common"
)
type Wrapper struct {
	httpComm *HTTP
	mqttComm *MQTT
}
func NewWrapper(httpComm *HTTP, mqttComm *MQTT) *Wrapper {
	return &Wrapper{httpComm, mqttComm}
}
func (communication *Wrapper) StartCommunication() common.SyncServiceError {
	return nil
}
func (communication *Wrapper) StopCommunication() common.SyncServiceError {
	var err1, err2 error
	if communication.httpComm != nil {
		err1 = communication.httpComm.StopCommunication()
	}
	if communication.mqttComm != nil {
		err2 = communication.mqttComm.StopCommunication()
	}
	if err1 != nil {
		return err1
	}
	return err2
}
func (communication *Wrapper) selectCommunicator(protocol string, orgID string, destType string, destID string) (Communicator, common.SyncServiceError) {
	var comm Communicator
	var err common.SyncServiceError
	if protocol == "" {
		if common.Configuration.NodeType == common.CSS && common.Configuration.CommunicationProtocol != common.HybridMQTT &&
			common.Configuration.CommunicationProtocol != common.HybridWIoTP {
			protocol = common.Configuration.CommunicationProtocol
		} else {
			protocol, err = Store.RetrieveDestinationProtocol(orgID, destType, destID)
			if err != nil {
				return nil, err
			}
		}
	}
	switch protocol {
	case common.HTTPProtocol:
		comm = communication.httpComm
	case common.MQTTProtocol:
		fallthrough
	case common.WIoTP:
		comm = communication.mqttComm
	default:
		err = &Error{"Failed to select protocol for communication"}
	}
	return comm, err
}
func (communication *Wrapper) SendNotificationMessage(notificationTopic string, destType string, destID string, instanceID int64, dataID int64,
	metaData *common.MetaData) common.SyncServiceError {
	comm, err := communication.selectCommunicator("", metaData.DestOrgID, destType, destID)
	if err != nil {
		return err
	}
	return comm.SendNotificationMessage(notificationTopic, destType, destID, instanceID, dataID, metaData)
}
func (communication *Wrapper) SendFeedbackMessage(code int, retryInterval int32, reason string, metaData *common.MetaData, sendToOrigin bool) common.SyncServiceError {
	comm, err := communication.selectCommunicator(common.Configuration.CommunicationProtocol, "", "", "")
	if err != nil {
		return err
	}
	return comm.SendFeedbackMessage(code, retryInterval, reason, metaData, sendToOrigin)
}
func (communication *Wrapper) SendErrorMessage(err common.SyncServiceError, metaData *common.MetaData, sendToOrigin bool) common.SyncServiceError {
	comm, err := communication.selectCommunicator(common.Configuration.CommunicationProtocol, "", "", "")
	if err != nil {
		return err
	}
	return comm.SendErrorMessage(err, metaData, sendToOrigin)
}
func (communication *Wrapper) Register() common.SyncServiceError {
	comm, err := communication.selectCommunicator(common.Configuration.CommunicationProtocol, "", "", "")
	if err != nil {
		return err
	}
	return comm.Register()
}
func (communication *Wrapper) RegisterAck(destination common.Destination) common.SyncServiceError {
	comm, err := communication.selectCommunicator(destination.Communication, "", "", "")
	if err != nil {
		return err
	}
	return comm.RegisterAck(destination)
}
func (communication *Wrapper) RegisterAsNew(destination common.Destination) common.SyncServiceError {
	comm, err := communication.selectCommunicator(destination.Communication, "", "", "")
	if err != nil {
		return err
	}
	return comm.RegisterAsNew(destination)
}
func (communication *Wrapper) RegisterNew() common.SyncServiceError {
	comm, err := communication.selectCommunicator(common.Configuration.CommunicationProtocol, "", "", "")
	if err != nil {
		return err
	}
	return comm.RegisterNew()
}
func (communication *Wrapper) Unregister() common.SyncServiceError {
	if common.Configuration.CommunicationProtocol == "http" {
		comm, err := communication.selectCommunicator(common.Configuration.CommunicationProtocol, "", "", "")
		if err != nil {
			return err
		}
		return comm.Unregister()
	}
	return &Error{"ESS unregister only support in http communication protocol\n"}
}
func (communication *Wrapper) HandleRegAck() {
	comm, err := communication.selectCommunicator(common.Configuration.CommunicationProtocol, "", "", "")
	if err == nil {
		comm.HandleRegAck()
	}
}