This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LECO_DLMS_FCS | |
{ | |
static ushort[] fcstab = new ushort[256] | |
{ | |
0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, | |
0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, | |
0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, | |
0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, | |
0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, | |
0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
You need to call the below method once. It register the callback and fire it when there is a change in network state. | |
Here I used a Global Static Variable, So I can use it to access the network state in anyware of the application. | |
*/ | |
// You need to pass the context when creating the class | |
public CheckNetwork(Context context) { | |
this.context = context; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This method can be used to download an image from the internet using a url in Android. This use Android Download Manager to | |
download the file and added it to the Gallery. Downloaded image will be saved to "Pictures" | |
Folder in your internal storage | |
*/ | |
private void downloadImageNew(String filename, String downloadUrlOfImage){ | |
try{ | |
DownloadManager dm = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); | |
Uri downloadUri = Uri.parse(downloadUrlOfImage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$client = new \GuzzleHttp\Client(); | |
$url = "https://app.newsletters.lk/smsAPI?sendsms"; | |
$body['apikey'] = "YOUR_API_KEY"; | |
$body['apitoken'] = "YOUR_API_TOKEN"; | |
$body['type'] = "sms"; | |
$body['from'] = "My Sender ID"; | |
$body['to'] = "94711234567"; // Receiver Mobile No with Country Code | |
$body['text'] = "Your SMS"; |