* 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.
 */
session_start();
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../lib/Util/Util.php';
require_once __DIR__ . '/../lib/DC/DCService.php';
use Att\Api\Util\Util;
use Att\Api\DC\DCService;
$arr = null;
try {
    envinit();
    $dcService = new DCService(getFqdn(), getFileToken());
    $response = $dcService->getDeviceInformation();
    $dcaps = $response->getCapabilities();
    $headers = array('TypeAllocationCode', 'Name', 'Vendor', 'Model', 'FirmwareVersion', 'UaProf', 'MmsCapable', 'AssistedGps', 'LocationTechnology', 'DeviceBrowser', 'WapPushCapable');
    $valuesEntry = array($response->getTypeAllocationCode(), $dcaps->getName(), $dcaps->getVendor(), $dcaps->getModel(), $dcaps->getFirmwareVersion(), $dcaps->getUaProf(), $dcaps->isMmsCapable() ? 'Y' : 'N', $dcaps->isAssistedGps() ? 'Y' : 'N', $dcaps->getLocationTechnology(), $dcaps->getDeviceBrowser(), $dcaps->isWapPushCapable() ? 'Y' : 'N');
    $arr = array('success' => true, 'tables' => array(array('caption' => 'Device Capabilities', 'headers' => $headers, 'values' => array($valuesEntry))));
} catch (Exception $e) {
    $arr = array('success' => false, 'text' => $e->getMessage());
}
echo json_encode($arr);
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 * 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.
 */
session_start();
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../lib/Util/Util.php';
require_once __DIR__ . '/../lib/MMS/MMSService.php';
use Att\Api\Util\Util;
use Att\Api\MMS\MMSService;
$arr = null;
try {
    envinit();
    $mmsService = new MMSService(getFqdn(), getFileToken());
    $msgId = $_POST['msgId'];
    $response = $mmsService->getMMSStatus($msgId);
    $deliveryInfoList = $response->getDeliveryInfoList();
    $values = array();
    foreach ($deliveryInfoList as $deliveryInfo) {
        $values[] = array($deliveryInfo->getId(), $deliveryInfo->getAddress(), $deliveryInfo->getDeliveryStatus());
    }
    $arr = array('success' => true, 'text' => 'ResourceURL: ' . $response->getResourceUrl(), 'tables' => array(array('caption' => 'Status:', 'headers' => array('MessageId', 'Address', 'DeliveryStatus'), 'values' => $values)));
} catch (Exception $e) {
    $arr = array('success' => false, 'text' => $e->getMessage());
}
echo json_encode($arr);
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
    if (isset($_POST['areaCode']) && $_POST['areaCode'] != "") {
        $optArgs->setAreaCode($_POST['areaCode']);
    }
    if (isset($_POST['country']) && $_POST['country'] != "") {
        $optArgs->setCountry($_POST['country']);
    }
    if (isset($_POST['latitude']) && $_POST['latitude'] != "") {
        $optArgs->setLatitude($_POST['latitude']);
    }
    if (isset($_POST['longitude']) && $_POST['longitude'] != "") {
        $optArgs->setLongitude($_POST['longitude']);
    }
    return $optArgs;
}
$arr = null;
try {
    envinit();
    $adsService = new ADSService(getFqdn(), getFileToken());
    $category = $_POST['category'];
    $optArgs = parseArgs();
    $result = $adsService->getAdvertisement($category, $userAgent, $udid, $optArgs);
    if ($result === null) {
        $arr = array('success' => true, 'text' => 'No Ads were returned');
    } else {
        $arr = array('success' => true, 'tables' => array(array('caption' => 'Ads Response:', 'headers' => array('Type', 'ClickUrl'), 'values' => array(array($result->getAdsType(), $result->getClickUrl())))));
    }
} catch (Exception $e) {
    $arr = array('success' => false, 'text' => $e->getMessage());
}
echo json_encode($arr);
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 * 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.
 */
session_start();
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../lib/Util/Util.php';
require_once __DIR__ . '/../lib/SMS/SMSService.php';
use Att\Api\Util\Util;
use Att\Api\SMS\SMSService;
$arr = null;
try {
    envinit();
    $smsService = new SMSService(getFqdn(), getFileToken());
    $addr = Util::convertAddresses($_POST['address']);
    $addr = count($addr) == 1 ? $addr[0] : $addr;
    $msg = $_POST['message'];
    $notifyDeliveryStatus = isset($_POST['deliveryNotificationStatus']);
    $response = $smsService->sendSMS($addr, $msg, $notifyDeliveryStatus);
    $resourceUrl = $response->getResourceUrl();
    $resourceUrl = $resourceUrl == null ? '-' : $resourceUrl;
    $arr = array('success' => true, 'tables' => array(array('caption' => 'Message sent successfully', 'headers' => array('Message ID', 'Resource URL'), 'values' => array(array($response->getMessageId(), $resourceUrl)))));
} catch (Exception $e) {
    $arr = array('success' => false, 'text' => $e->getMessage());
}
echo json_encode($arr);
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */