⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 quiosq500httpgateway.java

📁 华为编程开发规范与案例, 华为编程开发规范与案例,华为编程开发规范与案例
💻 JAVA
字号:
// SMSLib for Java v3
// A Java API library for sending and receiving SMS via a GSM modem
// or other supported gateways.
// Web Site: http://www.smslib.org
//
// SMSLib is distributed under the terms of the Apache License version 2.0
//
// Copyright (C) 2002-2007, Thanasis Delenikas, Athens/GREECE
// Portions Copyright:
// Davide Bettoni, Clusone/ITALY, dbettoni@users.sourceforge.net
// Tomek Cejner, Polland, heretique@users.sourceforge.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.smslib.gateway;

import java.util.*;
import java.net.*;
import org.apache.log4j.*;
import org.smslib.*;

public class QuiosQ500HTTPGateway extends AbstractGateway
{
	private String username, password;

	Object SYNC_Commander;

	public QuiosQ500HTTPGateway(String id, String username, String password, Logger logger)
	{
		super(id, logger);
		started = false;
		this.username = username;
		this.password = password;
		this.from = null;
		SYNC_Commander = new Object();
		attributes = AbstractGateway.Attributes.SEND |
									AbstractGateway.Attributes.CUSTOMFROM |
									AbstractGateway.Attributes.BIGMESSAGES |
									AbstractGateway.Attributes.FLASHSMS;
	}

	public void startGateway() throws Exception
	{
		logger.info("Starting Gateway: " + gatewayId);
		connect();
		super.startGateway();
	}

	public void stopGateway() throws Exception
	{
		logger.info("Stopping Gateway: " + gatewayId);
		super.stopGateway();
	}

	public void readMessages(LinkedList<InboundMessage> msgList, InboundMessage.MessageClass msgClass) throws Exception
	{
		throw new UnsupportedOperationException("Unsupported Gateway operation!");
	}

	public InboundMessage readMessage(String memLoc, int memIndex) throws Exception
	{
		throw new UnsupportedOperationException("Unsupported Gateway operation!");
	}

	public void deleteMessage(InboundMessage msg) throws Exception
	{
		throw new UnsupportedOperationException("Unsupported Gateway operation!");
	}

	public float queryBalance() throws Exception
	{
		throw new UnsupportedOperationException("Unsupported Gateway operation!");
	}

	public boolean queryCoverage(OutboundMessage msg) throws Exception
	{
		throw new UnsupportedOperationException("Unsupported Gateway operation!");
	}

	private void connect() throws Exception
	{
	}

	public void sendMessage(OutboundMessage msg) throws Exception
	{
		sendMessage(msg, Priority.NORMAL);
	}

	public void sendMessage(OutboundMessage msg, Priority priority) throws Exception
	{
		URL url;
		LinkedList<HttpHeader> request = new LinkedList<HttpHeader>();
		LinkedList<String> response;

		logger.debug("Quios Q500: sendMessage().");
		url = new URL("http://qcaster.ewingz.com/qc25a");
		request.add(new HttpHeader("Host", "qcaster.ewingz.com", false));
		synchronized (SYNC_Commander) { response = HttpDriver.HttpPost(url, request); }
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -