print(fa.request("http://example.com/"):gsub("%b<>",""))))
(2015年12月現在)
日本、米国、カナダ、ベルギー、ブルガリア、チェコ、デンマーク、ドイツ、エストニア、アイルランド、
ギリシャ、スペイン、フランス、クロアチア、イタリア、キプロス、ラトビア、リトアニア、ルクセンブルク、
ハンガリー、マルタ、オランダ、オーストリア、ポーランド、ポルトガル、ルーマニア、スロヴェニア、
スロヴァキア、フィンランド、スウェーデン、英国、アイスランド、リヒテンシュタイン、ノルウェー、スイス、
モンテネグロ、マケドニア、セルビア、アルバニア、ボスニア・ヘルツェゴビナ、ロシア、ベラルーシ、
カザフスタン、ウクライナ、ジョージア、中国、香港、マカオ、台湾、韓国、インドネシア、シンガポール、
タイ、フィリピン、ベトナム、マレーシア、インド、オーストラリア、ニュージーランド、アラブ首長国連邦、
イスラエル、オマーン、カタール、クウェート、サウジアラビア、トルコ、バーレーン、ヨルダン、レバノン、
エジプト、ケニア、ナイジェリア、南アフリカ、モロッコ、チリ、ペルー、メキシコ、コロンビア、モルドバ
取っていない国の例: ブラジル,北朝鮮など
-
fatfsが必要
参考: http://www.betatechnology.jp/pp/index.php?%E3%83%8...
参考: http://www.betatechnology.jp/pp/index.php?%E3%83%8...
#define _FS_READONLY 1 /* This option switches read-only configuration. (0:Read/Write or 1:Read-only) / Read-only configuration removes writing API functions, f_write(), f_sync(), / f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree() / and optional writing functions as well. */ #define _FS_MINIMIZE 2 /* This option defines minimization level to remove some basic API functions. / / 0: All basic functions are enabled. / 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename() / are removed. / 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1. / 3: f_lseek() function is removed in addition to 2. */
/*-----------------------------------------------------------------------*/
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2016 */
/*-----------------------------------------------------------------------*/
/* If a working storage control module is available, it should be */
/* attached to the FatFs via a glue function rather than modifying it. */
/* This is an example of glue functions to attach various exsisting */
/* storage control modules to the FatFs module with a defined API. */
/*-----------------------------------------------------------------------*/
#include "diskio.h" /* FatFs lower layer API */
#include "Header.h"
/* Definitions of physical drive number for each drive */
#define DEV_RAM 0 /* Example: Map Ramdisk to physical drive 0 */
/*-----------------------------------------------------------------------*/
/* Get Drive Status */
/*-----------------------------------------------------------------------*/
DSTATUS disk_status (
BYTE pdrv /* Physical drive nmuber to identify the drive */
)
{
DSTATUS stat;
int result;
switch (pdrv) {
case DEV_RAM :
//result = RAM_disk_status();
// translate the reslut code here
stat = 0;
return stat;
}
return STA_NOINIT;
}
/*-----------------------------------------------------------------------*/
/* Inidialize a Drive */
/*-----------------------------------------------------------------------*/
DSTATUS disk_initialize (
BYTE pdrv /* Physical drive nmuber to identify the drive */
)
{
DSTATUS stat;
int result;
switch (pdrv) {
case DEV_RAM :
//result = RAM_disk_initialize();
// translate the reslut code here
stat = raw_init();
return stat;
}
return STA_NOINIT;
}
/*-----------------------------------------------------------------------*/
/* Read Sector(s) */
/*-----------------------------------------------------------------------*/
DRESULT disk_read (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Start sector in LBA */
UINT count /* Number of sectors to read */
)
{
DRESULT res;
int result;
switch (pdrv) {
case DEV_RAM :
// translate the arguments here
//result = RAM_disk_read(buff, sector, count);
// translate the reslut code here
res = raw_read(buff, sector, count);
// res = RES_ERROR;
return res;
}
return RES_PARERR;
}
/*-----------------------------------------------------------------------*/
/* Write Sector(s) */
/*-----------------------------------------------------------------------*/
DRESULT disk_write (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
const BYTE *buff, /* Data to be written */
DWORD sector, /* Start sector in LBA */
UINT count /* Number of sectors to write */
)
{
DRESULT res;
int result;
switch (pdrv) {
case DEV_RAM :
// translate the arguments here
//result = RAM_disk_write(buff, sector, count);
// translate the reslut code here
res = RES_ERROR;
return res;
}
return RES_PARERR;
}
/*-----------------------------------------------------------------------*/
/* Miscellaneous Functions */
/*-----------------------------------------------------------------------*/
DRESULT disk_ioctl (
BYTE pdrv, /* Physical drive nmuber (0..) */
BYTE cmd, /* Control code */
void *buff /* Buffer to send/receive control data */
)
{
DRESULT res;
int result;
switch (pdrv) {
case DEV_RAM :
// Process of the command for the RAM drive
res = RES_ERROR;
return res;
}
return RES_PARERR;
}
#pragma once
#include "diskio.h"
#ifdef __cplusplus
extern "C" {
#endif
DSTATUS raw_init();
DRESULT raw_read(
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Start sector in LBA */
UINT count /* Number of sectors to read */);
#ifdef __cplusplus
}
#endif
// ConsoleApplication1.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "Header.h"
#include "stdafx.h"
#include <windows.h>
#include <winioctl.h> // From the Win32 SDK \Mstools\Include
#include "diskio.h"
#include "ff.h"
void put_rc(FRESULT rc)
{
const TCHAR *p =
_T("OK\0DISK_ERR\0INT_ERR\0NOT_READY\0NO_FILE\0NO_PATH\0INVALID_NAME\0")
_T("DENIED\0EXIST\0INVALID_OBJECT\0WRITE_PROTECTED\0INVALID_DRIVE\0")
_T("NOT_ENABLED\0NO_FILE_SYSTEM\0MKFS_ABORTED\0TIMEOUT\0LOCKED\0")
_T("NOT_ENOUGH_CORE\0TOO_MANY_OPEN_FILES\0INVALID_PARAMETER\0");
FRESULT i;
for (int i = 0; i != rc && *p; i++ )
{
while ( *p++ );
}
_tprintf(_T("rc=%u FR_%s\n"), (UINT)rc, p);
}
//---------------------------------------------------
HANDLE hDev;
DWORD lpSectorsPerCluster;
DWORD lpBytesPerSector;
DWORD lpNumberOfFreeClusters;
DWORD lpTotalNumberOfClusters;
DSTATUS raw_init()
{
LPCTSTR lpRootPathName = _T("\\\\.\\F:\\");
LPCTSTR lpRootPyDriveName = _T("\\\\.\\F:");
GetDiskFreeSpace(
lpRootPathName, // ルートパス
&lpSectorsPerCluster, // クラスタ当たりのセクタ数
&lpBytesPerSector, // セクタ当たりのバイト数
&lpNumberOfFreeClusters, // 空きクラスタ数
&lpTotalNumberOfClusters // 全クラスタ数
);
//
// デバイス(物理ディスク)の読み込み、書き込みを行う
//
hDev = CreateFile(
lpRootPyDriveName, // パス。\\.\PhysicalDrive0
GENERIC_READ, // 書き込みも行う場合は GENERIC_WRITEも指定
FILE_SHARE_READ | FILE_SHARE_WRITE, // 排他制御。必ずこの2つを指定する
NULL, // NULLで問題無し
OPEN_EXISTING, // 必ずOPEN_EXISTINGを指定
FILE_ATTRIBUTE_NORMAL, // ファイル属性。
NULL
);
if(hDev == NULL )
return STA_NOINIT;
return 0;
}
DRESULT raw_read(
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Start sector in LBA */
UINT count /* Number of sectors to read */)
{
DWORD numBytesReaded;
unsigned long adr = lpBytesPerSector * sector;
SetFilePointer(hDev, adr, NULL, FILE_BEGIN); //ADRにシークする
// 実際に先頭から1セクタ(MBR)読み込む。IoControl等行っても良い
ReadFile(hDev, buff, count*lpBytesPerSector, &numBytesReaded, NULL);
if( numBytesReaded != (count*lpBytesPerSector) )
return RES_ERROR;
return RES_OK;
}
/*
// 物理ドライブ0の先頭1セクタ(512バイト)を読み込む
// http://kzpro.iga-log.com/Entry/112/
void ReadPhysicalDrive0()
{
LPCTSTR lpRootPathName = _T("\\\\.\\F:\\");
LPCTSTR lpRootPyDriveName = _T("\\\\.\\F:");
BYTE buf[512];
DWORD numBytesReaded;
int adr = 0;
HANDLE hDev;
DWORD lpSectorsPerCluster;
DWORD lpBytesPerSector;
DWORD lpNumberOfFreeClusters;
DWORD lpTotalNumberOfClusters;
GetDiskFreeSpace(
lpRootPathName, // ルートパス
&lpSectorsPerCluster, // クラスタ当たりのセクタ数
&lpBytesPerSector, // セクタ当たりのバイト数
&lpNumberOfFreeClusters, // 空きクラスタ数
&lpTotalNumberOfClusters // 全クラスタ数
);
printf("クラスタあたりセクタ: %d\n", lpSectorsPerCluster);
printf("セクタ当たりのバイト数: %d\n", lpBytesPerSector);
//
// デバイス(物理ディスク)の読み込み、書き込みを行う
//
hDev = CreateFile(
lpRootPyDriveName, // パス。\\.\PhysicalDrive0
GENERIC_READ, // 書き込みも行う場合は GENERIC_WRITEも指定
FILE_SHARE_READ | FILE_SHARE_WRITE, // 排他制御。必ずこの2つを指定する
NULL, // NULLで問題無し
OPEN_EXISTING, // 必ずOPEN_EXISTINGを指定
FILE_ATTRIBUTE_NORMAL, // ファイル属性。
NULL
);
int num;
printf("num?");
scanf("%X", &num);
adr = lpBytesPerSector * num;
SetFilePointer(hDev, adr, NULL, FILE_BEGIN); //ADRにシークする
// 実際に先頭から1セクタ(MBR)読み込む。IoControl等行っても良い
ReadFile(hDev, buf, lpBytesPerSector, &numBytesReaded, NULL);
printf("Read From F:\n");
printf("Adr: %08X\n", adr);
//BIN表示
for ( int x = 0; x<16; x++ )
printf("%02X|", x);
printf("\n");
for ( int x = 0; x<16; x++ )
printf("--+", x);
printf("\n");
for ( int y = 0; y<32; y++ )
{
for ( int x = 0; x<16; x++ )
printf("%02X|", buf[y * 16 + x]);
printf("\n");
}
// 使い終わったらハンドルを解放
CloseHandle(hDev);
}
*/
int _tmain(int argc, _TCHAR* argv[])
{
// ReadPhysicalDrive0();
FATFS FatFs; /* 論理ドライブのワーク エリア(ファイル システム オブジェクト) */
FIL fil; /* ファイル オブジェクト */
char line[82]; /* 行バッファ */
FRESULT fr; /* 戻り値 */
/* デフォルト ドライブにワークエリアを与える */
f_mount(&FatFs, "", 0);
int i=0;
printf("FlashAir raw FAT reader\n");
printf("( + FatFs R0.12c )\n");
while(1)
{
printf("Read xxx.txt %10d:",i);
/* テキスト ファイルを開く */
fr = f_open(&fil, "xxx.txt", FA_READ);
// put_rc(fr);
if ( fr ) return (int)fr;
/* 1行ずつ読み出して表示 */
while ( f_gets(line, sizeof line, &fil) )
printf(line);
/* ファイルを閉じる */
f_close(&fil);
printf("\r");
Sleep(16);
i++;
}
return 0;
}
- SD ver4.00 SDHC規格準拠
- 動作電圧 +2.7V 〜 +3.6V DC
- 温度範囲 -25 〜 85℃
- 湿度 95%RH@25℃(結露なきこと)
- 質量2g
- IEEE802.11 b/g/n (2.4GHz)
- DSSS/CCK (1, 2, 5.5, 11Mbps)
- OFDM(6〜72.2Mpbs)
- WEP, TKIP, AES(WPA, WPSA2)
- QoS: EDCA (EMM)
- サーバー: HTTP,DHCP
- クライアント: HTTP, DHCP, DNS, NetBIOS (バージョンアップにより追加: SMTP, FTP)
- 電波認証取得80カ国
(2015年12月現在)
日本、米国、カナダ、ベルギー、ブルガリア、チェコ、デンマーク、ドイツ、エストニア、アイルランド、
ギリシャ、スペイン、フランス、クロアチア、イタリア、キプロス、ラトビア、リトアニア、ルクセンブルク、
ハンガリー、マルタ、オランダ、オーストリア、ポーランド、ポルトガル、ルーマニア、スロヴェニア、
スロヴァキア、フィンランド、スウェーデン、英国、アイスランド、リヒテンシュタイン、ノルウェー、スイス、
モンテネグロ、マケドニア、セルビア、アルバニア、ボスニア・ヘルツェゴビナ、ロシア、ベラルーシ、
カザフスタン、ウクライナ、ジョージア、中国、香港、マカオ、台湾、韓国、インドネシア、シンガポール、
タイ、フィリピン、ベトナム、マレーシア、インド、オーストラリア、ニュージーランド、アラブ首長国連邦、
イスラエル、オマーン、カタール、クウェート、サウジアラビア、トルコ、バーレーン、ヨルダン、レバノン、
エジプト、ケニア、ナイジェリア、南アフリカ、モロッコ、チリ、ペルー、メキシコ、コロンビア、モルドバ
取っていない国の例: ブラジル,北朝鮮など
- Luaのメモリ消費は40KB前後
- メモリ使用量の限界から,長大なスクリプトを実行するのではなく,単機能のスクリプトを細かく実行する方が良い
- ざっくり言って200行が限界
- 電源投入時のLuaスクリプト実行(LUA_RUN_SCRIPT)は5秒後
- ディレクトリセパレータには/と\の両方が使用可能
- LFNと8:3の両方に対応している.
- パスは絶対パス前提(相対パスは使用できない)
- 書き込み時実行(LUA_RUN_SCRIPT)は,ホストからの書き込みから500ms後に実行される
- 書き込みイベントなので,作成・変更・削除のいずれかは不明
- FlashAir側は書き込まれたセクタアドレスのみ知ることができる.
- 接続チェックはfa.WlanLinkを使うと良い
- LuaFileSystemで利用可能なAPIは,attribute, dir, mkdir, rmdirのみ
- ファイルの削除・変更はfa.removeおよびfa.rename
- (よりシンプルなファイル変更日時取得方法が示されている)
- fa.requestは3KBの制限
- ルート照明局の証明書を設定した場合,TLS通信において証明書チェックが行われ,不整合があれば失敗するようになる
(基本的にチェックは行われていないということか?)
- FTPクライアントはパッシブモードでのみ動作する
-

コメントをかく